Other templates?

Posts   
 
    
samjwest avatar
samjwest
User
Posts: 8
Joined: 01-Nov-2010
# Posted on: 09-Nov-2010 22:00:50   

I am using the 3.0 version and I'm confused as to what templates are available for source generation. I want to know what I should expect to be generated source vs code left to developers and while I see numerous good examples of implementing auditing/authentication/validation/wfc/etc, I can't see how to include templates for these things.

My project is a Model 1st, DDD/N-layer design targeting EF v4.0 and I'm happy with the entity classes created being created. I've tried creating my own project template bindings but I can't seem to find any additional templates to bind to. I see people mentioning other template sets not apparently part of the main download but I don't see them anywhere on the site. I feel like I'm missing something significant.

I've been reading the Template Viewer/Editor docs and I expect to have to create some lpt templates but I don't want to recreate the wheel either.

Can anyone offer any help and or recommendations for what I am planning?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 09-Nov-2010 23:46:47   

The templates "officially" available for generation are the ones that are installed with the product, and available for selection. Things like Authentication/Authorisation/Auditing etc are not available as templates, mainly because they are too specific to each system. For items like these the LLBLGen framework provides suitable "hooks" (overidable methods, interfaces etc) for you to be able to write your own code to be used for these mechanisms.

The third party frameworks (EF, LinqToSQL and Nhibernate), again, only have the templates supplied available. The creation of the above mechanisms for these framesworks is left entirely to you.

There are some additional templates available (for the LLBLGen framework only) for download from the customer section of the website. These cover items like an ASP.Net GUI, manager classes and DTO classes. Most of these have been donated by the communtiy, and not all of them have yet been ported to V3.

Can you be more specific about what you are trying to acheive ? This will make it easier for us to point you in the right direction.

Matt

samjwest avatar
samjwest
User
Posts: 8
Joined: 01-Nov-2010
# Posted on: 10-Nov-2010 00:05:29   

I'm generating the Self Tracking POCO entity classes (w/ TypedLists & TypedViews) but that's all. I guess I was expecting to at least get some interfaces or hooks on where to add our cross cutting concerns like authentication, auditing, etc. If I have to write templates to create everything else, then I'm not sure how much value there is over what Entity Framework will create for us. Other than generating 2 way updates, which IS a big thing.

We were sold on LLBLGen partially by seeing things like this on the website:

"Features like auditing, authorization and validation, among others, usually aren't written until it's found necessary to do so, stopping the developer from making the business logic he was working on. LLBLGen Pro offers these features, and many, many more by default. All a developer has to do, is just use them. "

Is this misleading or am I missing something?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Nov-2010 05:25:44   

LLBLGen offers you the possibility to generate code for different OR/M frameworks. So you still can generate Entity Framework, or LLBLGen Framework.

If you generate LLBLGen Framework, it includes all the plumbing so you can "use" features like Auditing/Validation/Authorization.

That is because LLBLGen doesn't know how you would like to audit (what fields to audit, how retrieve the user id, audit in a file? in db? in a 3rd system?), or how to validate (which rules apply to know if some field/entity/set is "valid"), or how to authorize. I think I made a point.

Even if you use Entity Framework, you have to write your audit trail implementation, for instance.

Then, when you know how would you like to implement such things (which could be in a very special and unique way you do) you can write templates so you don't have to repeat code every time. In templates you can use all information based on the metadata retrieved from db. There are things you can put in a template in a simple way. For instance, a validation rule: Order.ShipDate should be older than the Order.CreationDate.

Hope helpful wink

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 10-Nov-2010 08:45:57   

samjwest wrote:

I'm generating the Self Tracking POCO entity classes (w/ TypedLists & TypedViews) but that's all. I guess I was expecting to at least get some interfaces or hooks on where to add our cross cutting concerns like authentication, auditing, etc. If I have to write templates to create everything else, then I'm not sure how much value there is over what Entity Framework will create for us. Other than generating 2 way updates, which IS a big thing.

The major advantage with respect to the vanilla EF designer is that our designer has many features the EF designer doesn't have. It's true we don't generate every feature we have in our own framework into the EF codebase (yet). With EF, doing auditing and the like is a tad difficult btw, it's a very closed framework. For NHibernate for example, it's a contrib functionality already provided by 3rd party libraries.

We were sold on LLBLGen partially by seeing things like this on the website:

"Features like auditing, authorization and validation, among others, usually aren't written until it's found necessary to do so, stopping the developer from making the business logic he was working on. LLBLGen Pro offers these features, and many, many more by default. All a developer has to do, is just use them. "

Is this misleading or am I missing something?

It's a remark of our own framework, which supports all that. It lacks some information regarding other frameworks, I agree with that. We'll look into changing this.

For future releases, we do have planned extra features for the supported frameworks, however it's not always possible to add these features. For example authorization, EF doesn't have extension points to build it in, and auditing is the same thing: it requires an active action from the developer to audit changes, which is not what you want: you want transparent auditing, where changes are tracked in an auditor which provides entities to be persisted with the rest.

Frans Bouma | Lead developer LLBLGen Pro
samjwest avatar
samjwest
User
Posts: 8
Joined: 01-Nov-2010
# Posted on: 10-Nov-2010 14:44:31   

Thank you very much for explaining. I have a much better understanding now and can work with that. I'll create a LLBLGen project to compare the generated functionality and we'll decide which way to go then.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 10-Nov-2010 15:47:48   

samjwest wrote:

Thank you very much for explaining. I have a much better understanding now and can work with that. I'll create a LLBLGen project to compare the generated functionality and we'll decide which way to go then.

If poco is a requirement, you can also go for NHibernate (which we also support, and you can switch your llblgen project inside the designer to another target framework at any time simple_smile ), which offers auditing, authorization and validation through 'event listeners' (previously 'interceptors') http://knol.google.com/k/fabio-maulo/nhibernate-chapter-11-interceptors-and/1nr4enxv3dpeq/14#view

There are several open source contrib projects for NHibernate implementing various interceptors for tasks like auditing.

Frans Bouma | Lead developer LLBLGen Pro