Custom 3rd project

Posts   
 
    
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 10-Jun-2015 22:13:09   

Hi,

is it possible to generate a custom project (3rd one) that will contain e.g. models ? If so can anyone point me to some blog or something ?

Thanks

LLBLGen 4.2 Fresh project so there are no backward compatibility needed

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-Jun-2015 07:34:35   

Please elaborate more on what 'custom project' means. I guess you want a project that contains some kind of DTOs. For that you could write your own custom templates and include them in your generation process.

I recommend to start reading the SDK Documentation to understand the generation process and how you can extend it with your own templates.

You also could take a look to the 'ASP.NET GUI generator templates' (which generates a GUI project for your entities), available on the download section of the customer area at the LLBLGen site. This could as an example of how to do it.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-Jun-2015 11:49:00   

If it's about models onto entity models, this is coming to v5. So it would be interesting to know what you mean indeed with 'model' here simple_smile

Frans Bouma | Lead developer LLBLGen Pro
khorvat avatar
khorvat
User
Posts: 65
Joined: 17-Feb-2011
# Posted on: 16-Jun-2015 09:28:12   

Hi,

sorry for late reply, forum notifications went to Gmail spam folder - for the first time in all these years. I have been using templates in previous projects and I had one project that we used ASP.NET GUI generator templates but this isn't what I'm looking for.

I need DTOs/Pocos/Models however you call them to be simple object generated in a 3rd class library project (so this is one) and then I need interfaces for these objects to be generated in 4th class library project.

I need this in order to have onion architecture, IoC and DI where my upper layers don't know anything about LLBLGen. I think this is pretty straight forward scenario but I can't find a blog/article describing how to generate additional project beside existing ones ?

Is this the feature that will be available in v5 or ?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Jun-2015 10:13:18   

khorvat wrote:

Hi,

sorry for late reply, forum notifications went to Gmail spam folder - for the first time in all these years. I have been using templates in previous projects and I had one project that we used ASP.NET GUI generator templates but this isn't what I'm looking for.

I need DTOs/Pocos/Models however you call them to be simple object generated in a 3rd class library project (so this is one) and then I need interfaces for these objects to be generated in 4th class library project.

The DTOs should be 1:1 representatives of the entities, without navigators? and you can save entities back?

Anyway, the template system works as follows: in a preset it adds all file names generated to a cache and all file names in that cache are added to a vs.net project file if that task is executed. The best starting point is the adapter preset, as it generates two vs.net projects and you can see the settings needed (e.g. clear the cache when the second project is generated). For DTOs and interfaces, you need to add two templates in a new task group with at the end in each task group a vs.net project template task like in adapter. One of the two templates simply generates a DTO, the other generates an interface. The DTO class implements the interface (which is simply named I<name> and the DTO is named <name>DTO)

To fetch them, you could use automapper, e.g. generate automapper mappings from the project using another template.

I need this in order to have onion architecture, IoC and DI where my upper layers don't know anything about LLBLGen. I think this is pretty straight forward scenario but I can't find a blog/article describing how to generate additional project beside existing ones ?

Is this the feature that will be available in v5 or ? Thanks

In v5 you'll be able to define derived models on top of the entity model, denormalized or 1:1 that's up to you. You can choose between Document database class models (which require an id) and DTOs (which don't) and generate code from them in various forms. Your interface suggestion will be added to the list of projects we'll offer. The elements in the derived models will be hierarchical, so you can have an OrderDTO which contains a Customer object with e.g. limited info from a Customer entity.

We're not done with this feature (the code generation part and the last part of the modeling editor has to be done still) so I can only tell you what we've planned: using automapper we hope to achieve 2-way usage of the DTOs: fetching them and also persisting them (the root entity that is) however that last part might not always be available / work due to denormalization. Additionally, as there's typically no change tracking inside a DTO, the route back to the DB will require a fetch of a live entity which is then updated with the values in the DTO and then persisted.

As v5 is still in development, I'd suggest to first look at templates for v4. You can start by using DTO templates which have been posted on this forum. E.g. see: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=21592

Frans Bouma | Lead developer LLBLGen Pro