Modifying created class again by receipt

Topics: July and December Releases Forum
Jan 23, 2007 at 2:06 PM
I was wondering how I can modify by using the guidance receipt a class that was created previously by guidance receipt.

For example, I created the data contract by using the receipt and I got the class generated. After while, I realized that the properties I gave were not correct and I need to make some modifications.

So, is it possible to go back and change it by using the guidance receipt again for generated classes or do I have to do the modification in code?

Alexander


Coordinator
Jan 23, 2007 at 8:01 PM
Hey Alexander,

To answer your question right away ... once code has been generated from a recipe, there is not a way to use a recipe to regenerate that code again without having to re-complete the wizard. We call this feature (what you're asking for) "reentrancy". In other words, the code generation should be reentrant. It is not today, but we plan to include in the next version (keep reading), but for now ...

There are a number of things you can do if you need to change some code that was generated:

1. You can use the same recipe to regenerate the code, but the wizard will not be pre-populated with the values that were specified the first time you ran it.

2. You can keep the code that was generated in place and just create another partial class with the same name that contains the change (if the change was an method, overload, or inheritance addition).

3. If the code is a DataContract or ServiceContract, we've installed some Visual Studio Code Snippets you can use to add DataMembers, OperationContract, etc. If you want to see the Code Snippets, just use intellisense. They all start with "wcf" (i.e. wcfDM for creating a new DataMember).

The guidance is to never modify generated code. Always use a partial class or regenerate the code.

This limitation is a result of not having a "model" - today the code IS the model (not optimal for reentrancy). The next version of Service Factory will have a model. We would love customer feedback on this. You can read more about our initial thoughts here: http://www.codeplex.com/servicefactory/WorkItem/View.aspx?WorkItemId=9. Let us know what your thoughts and questions are.

Hope this helps,
Don
Jan 24, 2007 at 8:57 AM
Dan,

Thanks for your reply.

I start building a proto type by using the WCF Service Factory and Smart Client Factory. I will summaries my experience related to the WCF service factory and provide feedback in end of the prototype, approx in two weeks. Do you have any standardized feedback questioner? If not, I will try to find a one from previous works.

Alexander
Coordinator
Jan 24, 2007 at 4:14 PM
No, I don't have a standardized feedback questionaire, but I am going to be putting one together eventually (when things aren't as crazy as they are right now) :)

For now, just your thoughts is cool. I can always follow-up as needed. Thanks!

Don