Type Initiazer error

Posts   
 
    
Sandumone1
User
Posts: 27
Joined: 28-Oct-2009
# Posted on: 03-Nov-2009 23:21:00   

The database is : SQL server Runtime version : LLBLgen 2.6 Final release : Oct 9 2009.

The type initializer error is coming on running thsi LINQ query.

LinqMetaData metaData = new LinqMetaData(); var q = from c in metaData.UiFlowMachine where c.MachId == 283 select c;

the execution of this query is not giving any data , but an error below.

The error is :

StackTrace

" at uFACTS.BusinessEntities.FactoryClasses.EntityFactoryFactory..cctor() in C:\uFACTSFramework\Service Tier\Business Logic\uFACTS.BusinessEntities\_generated\FactoryClasses\EntityFactories.cs:line 1883" string

Exception Thrown :

  • base {"The type initializer for 'uFACTS.BusinessEntities.FactoryClasses.EntityFactoryFactory' threw an exception."} System.SystemException {System.TypeInitializationException}

  • [System.NullReferenceException] {"Object reference not set to an instance of an object."} System.NullReferenceException

The line 1883 is in this method in EntityFactories.

/// <summary>Initializes the <see cref="EntityFactoryFactory"/> class.</summary> static EntityFactoryFactory() { Array entityTypeValues = Enum.GetValues(typeof(uFACTS.BusinessEntities.EntityType)); foreach(int entityTypeValue in entityTypeValues) { IEntity dummy = GeneralEntityFactory.Create((uFACTS.BusinessEntities.EntityType)entityTypeValue); _factoryPerType.Add(dummy.GetType(), dummy.GetEntityFactory()); } }

I saw some links talking about the EntityType Enum and changing it and all. Could not understand what to do exactly.

The unknown entitytype is sent when we are using LINQ to LLBLGen pro .

Can you please suggest what to do?

I tried with different entities and the result is the same.

thanks sam

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Nov-2009 04:16:01   

Duplicated thread. Followed here: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=16861 (please open just one thread per issue).

David Elizondo | LLBLGen Support Team