POCO generation using templates

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
[email protected]
Posts: 10
Joined: Mon 30 May 2011 20:58

POCO generation using templates

Post by [email protected] » Wed 01 Jun 2011 21:26

When I add a POCO template to the model in VS 2010 a ModelName.POCO Entity.tmpl file is created. There is no Custom Tool assigned to it, so, it is NOT part of the build process.
If I use the TextTemplatingFileGenerator which is used for the T4 templates in VS, the transformation won't run, because:
No processor was specified for a directive named 'property'. The transformation will not be run. ... Gdnet2.POCO Entity.tmpl

Is this supposed to work in VS environment, or is this feature work in Entity Developer only?

When I use the custom generation, do I have to turn off the default DevartLinqToSqlGenerator for the lqml file, similarly to the EF POCO templates?

[email protected]
Posts: 10
Joined: Mon 30 May 2011 20:58

Post by [email protected] » Thu 02 Jun 2011 11:35

Additional info: if I use . (current directory) for the context output destination folder, Entity Developer create the generated artifacts in my start menu, because the current directory is the folder of the shortcut which started the developer gui. It would be more appropriate to use the .lqml location as the current directory when I use relative paths in the template outputs.

The current solution forces me to use absolute paths, so, the generation won't work when somebody checks out the code to a different folder from the source control.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 03 Jun 2011 13:38

The custom tool should be set for the main model file (.lqml) only. In this case, all active templates are run on this model. For example, if you've activated the POCO and LinqConnect templates, they both will generate the context and entity classes. Provided that the default output directory is used, the latter template will overwrite the classes generated by the first one.

As for setting the output folder, could you please specify how exactly you are doing this? For example, you can browse your solution (use the '...' button in the 'Context Output' and 'Entities Output' properties of the template), and select a folder in the specified project. In this case, no absolute paths should be used.

Post Reply