Hi there,
I'm trying to use the DataAccessAdapter.FetchEntityCollection() using a Generic EntityCollection. Therefore i try to create a new EntityCollection<T>().
While constructing the collection i get the follwing error:
"No parameterless constructor defined for this object."
// HelperClasses\EntityCollection.cs Line: 71
//
Line 69: {
Line 70: /// <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>
Line 71: public EntityCollection() : base( (IEntityFactory2)null )
Line 72: {
Line 73: }
It seems there is a Parameterless Constructor....
My code:
public class LlblGenRepository<TEntity> : IRepository<TEntity> where TEntity : EntityBase2, IEntity2, ITenantEntity
{
public IQueryable<TEntity> List()
{
EntityCollection<TEntity> list = new EntityCollection<TEntity>();
...
adapter.FetchEntityCollection(list, null);
return (IQueryable<TEntity>)list;
}
}
**Stack Trace: **
[MissingMethodException: No parameterless constructor defined 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
SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase21.DetermineEntityFactory() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\EntityCollectionBase2.cs:1499
SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2
1..ctor(IEntityFactory2 entityFactoryToUse) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\EntityCollectionBase2.cs:116
X.Y.Data.HelperClasses.EntityCollection`1..ctor() in c:\Myprojects\VS.NET Projects\DatabaseGeneric\HelperClasses\EntityCollection.cs:71
X.Y.Business.Logic.PartyManager.ListCustomers() in c:\Myprojects\VS.NET Projects\X.Y.Business.Logic\PartyManager.cs:136
...
What's it i'm doing wrong? or isn't it possible to construct a Generic EntityCollection?
Version: 3.1 Final
Regards, J