Generated entity in .net 4.5.1 having internal constructor

Posts   
 
    
Vivek30
User
Posts: 33
Joined: 30-Jun-2016
# Posted on: 22-Aug-2016 08:01:49   

I'm using llblgen pro version 2.6 with .net 3.5 and one of the entity has all its constructors as public but when I'm migrating the .net framework to 4.5.1 then the same entity gets generated with all constructors as internal. I can share my .lgp file or any structure that is required. Is there any alternative way to control the access specifier of constructors of generated entity through .lgp file?

LLblgen Pro version 2.6 .Net Framework 4.5.1

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 22-Aug-2016 09:39:50   

Is the entity marked as abstract? v2.6 doesn't support .net 4.5 by itself btw, as in: it doesn't have specific code for .net 4.x

Frans Bouma | Lead developer LLBLGen Pro
Vivek30
User
Posts: 33
Joined: 30-Jun-2016
# Posted on: 22-Aug-2016 10:08:10   

No, The entity is partial.

If I'm manually changing the internal access specifier of generated code to public then llblgen pro is working perfectly with .net 4.5.1

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 22-Aug-2016 17:56:57   

Was the entity marked as Abstract in the LLBLGen Pro Designer?

Vivek30
User
Posts: 33
Joined: 30-Jun-2016
# Posted on: 23-Aug-2016 06:33:44   

Yes, In llblgen pro it is having IsAbstract true.

Vivek30
User
Posts: 33
Joined: 30-Jun-2016
# Posted on: 23-Aug-2016 07:00:12   

I just now tried marking IsAbstract as false and I could see that now the constructor is public and havent observed any issues so far.

My question is, this entity was always abstract so does .net framework 3.5 and 4.5.1 treats an abstract entity differently.

Also by making this entity as non-abstract what could possibly be the consequences(worst case scenario).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 23-Aug-2016 09:57:03   

Vivek30 wrote:

I just now tried marking IsAbstract as false and I could see that now the constructor is public and havent observed any issues so far.

My question is, this entity was always abstract so does .net framework 3.5 and 4.5.1 treats an abstract entity differently.

If the entity is marked abstract, it always is generated with internal constructors. This is for .NET 1.x and .NET 2.x in v2.6's standard templates. I don't know why the constructors weren't internal before, the templates are generating the constructor as internal for abstract entities.

Also by making this entity as non-abstract what could possibly be the consequences(worst case scenario).

Nothing bad, it's however now possible to create an instance of that entity and save it to the DB. If you don't want developers to do that, you should keep marking the entity as abstract. That's the reason why the constructors are internal: the entity is abstract and therefore can't be directly created. The class isn't marked 'abstract' as one can fetch entities of that type as all subtypes are of that type.

Frans Bouma | Lead developer LLBLGen Pro