Code Generation

Only members of this group can post notes and use other group resources. Join now to get access to all group resources!
Log in or register to join this group

Code Generation development Stacking Code Generators  Viewed 19274 time(s), 2 post(s)., 10/23/2013 7:55:30 PM - by ColinBlair

ColinBlair
ColinBlair 10/23/2013 7:55:30 PM

Imported from Codeplex:

marcocasamento wrote Tue at 1:56 PM [x]

Can you elaborate on this issue ?



I'd like to see a more fine-grained T4 code generator, that allows me to override much more methods than in WCF RIA.

ColinBlair wrote Tue at 3:06 PM [x]

This came from Merijn originally from his work on M2M4RIA. His point was that he could create a custom code generator to generate M2M code but that custom code generator could not easily stack on top of some other custom code generator. That makes things difficult for a programmer who wants to customize code generation AND use Merijn's code generator.



The code generation code can be found in OpenRiaServices.DomainServices.Tools.TextTemplate. In terms of relative difficulty, it is a good place to start for anyone wanting to contribute.

marcocasamento wrote Today at 1:59 PM [x]

Ok, I know that namespace pretty well,, in my team we have been able to customize the TextTemplate code generator allowing things like cross DomainContext lazy load of associations and a very good degree of integration with Enterprise Library Validation Block.



However, I'm not sure about the problem of stacking code generators, apart from the mentioned issue that most method are not overridable, thus forcing to change the Whole class.



What's you idea ?

This content has not been rated yet. 
1539 Reputation 130 Total posts
1
Merijn
Merijn 10/27/2013 7:51:43 PM

As Colin explained, the issue originated from the implementation of M2M4RIA, which includes a dedicated code generator for generating m2m-specific client-side code. When you use m2m in your project by using the corresponding Nuget package, you may get into trouble if you're already using another code generator for Ria services. The problem is that in this case there is a) no way to specify how both code generators are to be combined, and b) there is (as far as I know) also now way the specify which code generator should be used. This may lead to unpredictable results, where your code may no longer compile or it may no longer work correctly.

It would be nice of the code generator process of Ria services was implemented as a customizable pipe-line where custom code generators could be easily plugged-in at specific locations. However, I'm aware of the fact that this would have a significant impact on the code generation process, because the extensible part is currently completely text-based. This makes it very hard, if not impossible to plug multiple code generators together.

Now that Ria services is open source and since we have plans to make m2m an integral part of Ria services, there will no longer be a need for a custom code generator for m2m itself. Still, it will be interesting to get some concrete ideas together about how such a pluggable code generator pipeline could be realized.

This content has not been rated yet. 
6 Reputation 1 Total posts
2