Entity Framework With POCO, etc.

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 29-Jun-2010 16:13:41   

I have a few questions that may be hard to articulate and/or may not make sense, as I am just in the early learning stages of EF4.

I have been playing with the POCO functionality (via the "T4" templates) for entity framework. Is this something that LLBLGen 3.0 already has templates for?

If so, do the templates essentially do the same thing that the MS templates do? IOW, will the code look the same whether it gets generated from the "T4" templates or the LLBLGen templates?

If I start a project using just Visual Studio, is it possible to switch to using LLBL? Or am I much better off starting with LLBL from the beginning?

Semi-related:

I have been using LLBLGen for about 5-6 years now, but have never delved into code generation. One of the things we are looking at in the EF/POCO realm is putting attributes on entity fields for things like field length, required/optional, etc. to handle certain UI and validation tasks in a uniform way. Is this something that is easy to do with the new integrated template editor?

Thanks,

Phil

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 29-Jun-2010 16:38:20   

psandler wrote:

I have a few questions that may be hard to articulate and/or may not make sense, as I am just in the early learning stages of EF4.

I have been playing with the POCO functionality (via the "T4" templates) for entity framework. Is this something that LLBLGen 3.0 already has templates for?

Yes, we support the same stuff: Pure poco's and SelfTracking entity classes (also poco's). We based our code on the T4 templates output and adjusted it where necessary.

If so, do the templates essentially do the same thing that the MS templates do? IOW, will the code look the same whether it gets generated from the "T4" templates or the LLBLGen templates?

yes, only better. wink (you can augment the code with attributes in the designer, you can specify base classes for entities... additional interfaces and namespaces...). Also our code is separated into separate projects: the db specific stuff with the edmx and context class in a persistence project and the model classes in a model project.

If I start a project using just Visual Studio, is it possible to switch to using LLBL? Or am I much better off starting with LLBL from the beginning?

There's currently no import functionality in the v3 designer so you can't import an existing edmx. The code generated by the t4's looks the same as what we generate (give or take) but is in the same project as the edmx file, which is not what you want. So I'd start with the llblgen pro project and generate code from there. You then also don't lose any sleep over the horrid designer MS shipped.

one caveat: we don't support m:n relationships at the moment in EF. EF only supports 'pure' m:n (so the intermediate entity is 'empty') and we did plan to add that but currently it's not supported, however we do have plans to add this soon.

Semi-related: I have been using LLBLGen for about 5-6 years now, but have never delved into code generation. One of the things we are looking at in the EF/POCO realm is putting attributes on entity fields for things like field length, required/optional, etc. to handle certain UI and validation tasks in a uniform way. Is this something that is easy to do with the new integrated template editor? Phil

It's easier simple_smile You can do this right in the designer simple_smile . See: http://www.llblgen.com/documentation/3.0/Designer/hh_goto.htm#Functionality%20Reference/EntityEditor_CodeGenerationInfoTab.htm

(attributes tab) and: http://www.llblgen.com/documentation/3.0/Designer/hh_goto.htm#Functionality%20Reference/AttributeDefinitionMacros.htm

for the macro language.

You can define attributes on a meta-level in the project properties, code gen meta-data defaults tab, so 'per entity' or 'per field' which are inherited by each instance of that element type. Then you can edit them on a field basis or entity basis in the editor of an entity.

The current system can't assign attributes based on rules you set, which could be solved with a little plug-in which takes care of that. We have plans to add that in the (near) future.

Frans Bouma | Lead developer LLBLGen Pro