Code-namespace of generated code

Topics: Service Factory Modeling Edition Forum
Jan 10, 2008 at 1:00 PM
I'm currently using WSSF to develop a number (15-25) of services within the same solution, the problem is that all generated code from the service-models is using the same code-namespace.

Is it possible to specify on a service- og datamodel which code-namespace to use when generating code?

/Jan
Jan 10, 2008 at 3:47 PM
The code namespace is taken from the target project (according to its roles) default namespace. You can change that from the text temaplates (.tt) or from the project namespace property.
Jan 11, 2008 at 7:24 AM


charlyfriend wrote:
The code namespace is taken from the target project (according to its roles) default namespace. You can change that from the text temaplates (.tt) or from the project namespace property.


Ok, so I cannot (at the moment ;) specify on a model-level which code namespace is used?

My problem is that I have multible services where I want to use the same methodnames, and therefore the same request- and replymessage names. When generating code, existing generated classes are overwritten based on the classname. So in this scenario I have to come up with unique message- and method name, and more over the models does not validate that another message og method allready exist.

Is this a candiate for a change-request?

/Jan
Jan 11, 2008 at 4:30 PM
Perhaps I'm missing something but you can use different MessageContract projectsand therefore have the same message names on the different services (and operation names as well). This way you won't have the clash issue described. For this you may need different PMT on each service contract but the only difference will be the MessageContract project that will point to different projects.

Regards,
CF.
Jan 14, 2008 at 7:41 AM
Edited Jan 14, 2008 at 7:41 AM


charlyfriend wrote:
Perhaps I'm missing something but you can use different MessageContract projectsand therefore have the same message names on the different services (and operation names as well). This way you won't have the clash issue described. For this you may need different PMT on each service contract but the only difference will be the MessageContract project that will point to different projects.

Regards,
CF.


Yes, that could be one possible solution - but it results into at least one MessageContract project, and therefore at least one assembly, pr. service.. and I have some 15-20 services... Not all services have nameclashes though. The optimal solution (I think :) is to make it possible in the model-properties, where I specifiy XML-namespace and implementation-technology, to specify which .net namespace is used when generation the code...

/Jan
Jan 14, 2008 at 7:14 PM
That might be the optimal solution in case you may want to override the default ns value. However that will imply an update of the package. Feel free to read the docs and HoLs and try adding that property. Let me know if you need further tips or som other hint on that.

Thanks,
CF.
Jan 15, 2008 at 7:54 AM


charlyfriend wrote:
That might be the optimal solution in case you may want to override the default ns value. However that will imply an update of the package. Feel free to read the docs and HoLs and try adding that property. Let me know if you need further tips or som other hint on that.

Thanks,
CF.


OK, I'll look into it :) .. How do I contribute to the project? - can I become a member - or just send the updated files to someone?

/Jan
Jan 15, 2008 at 5:10 PM
Send me an email so I can give you further instructions on how to publish this to the WSSF wiki.

Thank you very much,
CF.
Aug 8, 2008 at 2:18 PM
I'm thinking of solving this same problem in our customization. My thought was also to just add a new model property to be the suffix of the namespace into which to generate the classes. I would apply this for both service and data contract models.

My only concern is that the last activity in this thread was from back in January, so I want to make sure of whether there have been any plans for adding a feature like this to a future release of the SF. I just don't want to do the same thing in an incompatible way.
Aug 11, 2008 at 3:23 PM
Hi John, you can find the product roadmap here: http://www.codeplex.com/servicefactory/Wiki/View.aspx?title=V3Roadmap&referringTitle=Home . However, I haven't seen any reference to this namespace's feature. I would advice you to add it as a nice to have suggestion in the Known Issues section so it can be considered for the next release.

Thanks