Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Custom Templates> templates from 2.6 to 4.2
 

Pages: 1
Custom Templates
templates from 2.6 to 4.2
Page:1/1 

  Print all messages in this thread  
Poster Message
rene2020
User



Location:

Joined on:
24-Mar-2015 14:53:10
Posted:
3 posts
# Posted on: 24-Mar-2015 15:50:30.  
First of all I’m a new user of llblgen, so I don't know all features and settings of llblgen. Recently we started to maintain a C# solution that is built on the LLBLgen Generated code. This solution is made in llblgen 2.6 with custom templates. So, I used the "v2.x to v4.x migration templates" to get a migrated project file which I can use in de 4.2 version of llblgen. But when I’m generating the code by hitting f7, start generator, I get the following exception in the generated class lptTempDebugSourceInclude.cs:

Exception type: GeneratorAbortException
Compilation of templates threw errors:
Error CS0234, at line: 26, pos: 38: The type or namespace name 'Entities' does not exist in the namespace 'SD.LLBLGen.Pro.ApplicationCore' (are you missing an assembly reference?)
Error CS0246, at line: 350, pos: 37: The type or namespace name 'EntityRelation' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246, at line: 363, pos: 52: The type or namespace name 'EntityFieldDefinition' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246, at line: 382, pos: 51: The type or namespace name 'EntityFieldDefinition' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246, at line: 531, pos: 37: The type or namespace name 'EntityRelation' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246, at line: 544, pos: 52: The type or namespace name 'EntityFieldDefinition' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246, at line: 563, pos: 51: The type or namespace name 'EntityFieldDefinition' could not be found (are you missing a using directive or an assembly reference?)

The code file wants to use a namespace (using SD.LLBLGen.Pro.ApplicationCore.Entities) that isn't available anymore. I’ve read something here which describes my problem--> http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=19239 But I don't know where I have to change this.

Do I have to change it in the lptTempDebugSourceInclude.cs file and copy paste something back in the lpt or template files or do I have to change the lpt/ template files where I don't have intelligence?

I'm a little bit confused how this works. Can you put me in the right direction?


Cheers

Rene
  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8034 posts
# Posted on: 25-Mar-2015 07:17:29.  
Are you using the templates on v2.6 Designer, right? Are you doing all steps in the instructions?

David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
rene2020
User



Location:

Joined on:
24-Mar-2015 14:53:10
Posted:
3 posts
# Posted on: 25-Mar-2015 09:13:07.  
Yes i do. the projectfile is converted correctly, but the templates (*.lpt and *.template) are not converted. I don't know if they should be converted with this action or not... I think i have to convert them by some tool, but i don't know how.

I used the llblgen pro version 2.6 final (october 9th ,2009) to create the new project file.
  Top
rene2020
User



Location:

Joined on:
24-Mar-2015 14:53:10
Posted:
3 posts
# Posted on: 25-Mar-2015 09:36:01.  
Can you also tell me how i can fix this issue: Error CS0246, at line: 531, pos: 37: The type or namespace name 'EntityRelation' could not be found (are you missing a using directive or an assembly reference?) --> to which object is EntityRelation renamed?

the entityrelation seems to be in another namespace.

Do i have to maintain the templates and references in visual studio before generate the code? i'm a little bit lost where to start

I uploaded my templates on http://we.tl/ntvwf1hSwH . I hope you can point me in the right direction.

Rene


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14429 posts
# Posted on: 25-Mar-2015 19:34:58.  
Quote:
The code file wants to use a namespace (using SD.LLBLGen.Pro.ApplicationCore.Entities) that isn't available anymore.

Please use SD.LLBLGen.Pro.ApplicationCore.EntityModel instead.
Quote:
But I don't know where I have to change this.

I see you have the following line in dataContractModel.template.lpt
Code:
<[ SD.LLBLGen.Pro.ApplicationCore.Entities ]>


Quote:
to which object is EntityRelation renamed?

Please try NormalRelationshipEdge.
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37236 posts
# Posted on: 26-Mar-2015 09:23:05.  
(you can remove the download now)

Indeed, the object model is different in v3+. Please see the     LLBLGen Pro v4.2 designer / algorithmia assemblies reference manual, which contains the documentation on the object model in the designer. Also take a look at the SDK here: http://www.llblgen.com/documentation/4.2/SDK/hh_start.htm for template specific details. We added helper logic for .lpt templates in the GeneratorUtils class, you can see how they work in the shipped .lpt templates for e.g. EF, Linq to Sql and NHibernate.

You are facing a tough job though. The issue is that the templates are likely covering functionality that's built into the designer/runtime now so you don't have to port that as it likely is redundant. E.g. the .xml file in your templates is bad. I don't know who wrote this, but it's not how we intended the system should be used as it's totally unmaintainable: it requires that the .xml file is updated as well as the normal model, which is of course not OK.

The designer nowadays can generate attributes with rules on entities out of the box, you don't need an xml file with a contact. Besides, every entity already has an object ID which is a guid in the object model, so you don't need that file anymore.

Best way to deal with what you're facing is:
- look at the functionality that's been generated extra with the extra templates
- look whether the extra functionality isn't already in the framework or in the designer
- port over only what isn't in the runtime/designer, and try to use the reference manuals and SDK as starting point.

For the .lpt templates:
The object model in v4 is a graph, everything is in the Project object which contains EntityModel (which is a nondirected graph with entities as vertices and relationships as edges), MetaData which is the database data and MappingData which is the mapping container. Most of this can be utilized using generatorutils (which is in GeneratorCore), see e.g. the linq to sql templates which are easy to start with: you can quickly see how to obtain relationships, entities, fields etc. by looking at these templates.
You can view the object model inside the designer, by loading a project, right-click the project node in project explorer -> Run plugin -> project inspector. This opens a tab with the object model so you can view what's where.
To see what objects are returned by a piece of code targeting the object model, you can try it out in the Element Search: you can type any C# code there and see what objects are returned.

For the .template templates, these should be ported easily without much change.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.