Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> v 4.0 Adapter. Error on derived entity with no new fields
 

Pages: 1
Bugs & Issues
v 4.0 Adapter. Error on derived entity with no new fields
Page:1/1 

  Print all messages in this thread  
Poster Message
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 06-Jun-2013 17:46:37.  
v.4.0 6th June release (15th may build). Adapter. Worked OK in v.3.5

BaseProfile is the abstract SuperEntity of a hierarchy. Has 4 fields, one of them is DiscriminatorField.

AdministratorProfile is a derived entity with those 4 fields (no new field)
and DiscriminatorField = 1

Code:
EntityCollection<BaseProfileEntity> colmyRoles = new EntityCollection<BaseProfileEntity>();

produces the following error in EntityCollection constructor:
Code:

System.MissingMethodException: No constructor without parameters for this object
SourceCode error:
Línea 71:     {
Línea 72:         /// <summary>CTor which determines the factory to use from the generic type argument, unless TEntity is an abstract entity. If possible use the ctor which accepts a factory</summary>
Línea 73:         public EntityCollection() : base( (IEntityFactory2)null )
Línea 74:         {
Línea 75:         }
Archivo de origen: D:\tmp\N23_Adapter\DatabaseGeneric\HelperClasses\EntityCollection.cs    Línea: 73

Stack:
[MissingMethodException: No constructor without parameters for this object.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
System.Activator.CreateInstance(Type type) +6
SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2`1.DetermineEntityFactory() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\EntityCollectionBase2.cs:1478
SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2`1..ctor(IEntityFactory2 entityFactoryToUse) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\EntityCollectionBase2.cs:99
Northwind.HelperClasses.EntityCollection`1..ctor() in D:\tmp\N23_Adapter\DatabaseGeneric\HelperClasses\EntityCollection.cs:73


It is NOT a priority.

TIA
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14641 posts
# Posted on: 06-Jun-2013 19:45:19.  
BaseProfile is abstract, which means you can't instantiate from it.
The generated class for an abstract entity (marked as such in llblgen pro designer) has an internal constructor, so you can't create new instances of it.


  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 06-Jun-2013 22:17:37.  
Embarrassed Once it's not marked as abstract, everything works fine.
I should have tried first. Sorry
(it used to work that way, and as I was having problems with my calculated fields).

  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 06-Jun-2013 22:52:19.  
...but I'm still thinking. It should be abstract (meaning it isn't possible to create a base entity object with IsNew= true). But the use Im trying is only fetching filtered entities (polymorphic), which should be ok. Am I forgetting anything?

Kind regards


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8150 posts
# Posted on: 07-Jun-2013 08:07:40.  
Hi Jose,

A side note: v3.5 should raise the same error for that specific code (I tested it myself). Try specifying the factory, as the factory knows how to use/create that 'abstract' entity:
Code:
EntityCollection<BaseProfileEntity> colmyRoles =
     new EntityCollection<BaseProfileEntity>(new BaseProfileEntityFactory());

.. then you should check the type for each result to know what cast to use.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.