No abstract classes generated when define a entity as abstract

Posts   
 
    
chrissie
User
Posts: 84
Joined: 05-Oct-2010
# Posted on: 08-Mar-2011 12:08:42   

hi all,

i use LLBLGen 3.1 in conjunction with MS Enity Framework 4.0 (POCO), MS SQL Server 2008 R2, MS VS 2010, .Net 4.0 all on MS Windows 7 (64).

Now, when i define a inheritance hierachy and the root as abstract, i expect that the corresponding class in the generated code (in the model) is marked as abstract. but it is not. Why?

thanx in advance

regards

chris

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 08-Mar-2011 20:27:22   

I guess it should, but it I can't see it in the template anywhere. I'll get the dev team to take a look for you.

In the mean time can you confirm that the classed generated by visual studio for EF4 do produce the results you expect, as obviously our generated code should be indentical...

Thanks

Matt

chrissie
User
Posts: 84
Joined: 05-Oct-2010
# Posted on: 09-Mar-2011 09:43:16   

hi matt,

this is the confirmation.

thanx and regards

chris

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 09-Mar-2011 10:54:32   

In Entity framework, an abstract entity is a class which isn't mapped in the EDMX, but which is generated. In LLBLGen pro this is different: an abstract entity is an entity which can't be instantiated directly, however which is mapped. In LLBLGen Pro to get a class which is used in the model but which isnt mapped, simply set it as the base class for an entity (and write the class manually). This is more natural, as it's not part of the model.

Example: 'Person', is a supertype of 'Employee' and 'Customer' and not mapped to a table. In EF, this should be an abstract entity. In llblgen pro (designer) this 'Person' entity doesn't exist, as it's not mapped. If you want 'Person' as a supertype of Employee and Customer, specify it as the base class for Employee and Customer in their code gen information.

The generated class for an abstract marked entity in llblgen pro designer has an internal constructor, so you can't create new instances of it.

Frans Bouma | Lead developer LLBLGen Pro