Problem on creation of a new entity

Posts   
 
    
JayBee
User
Posts: 269
Joined: 28-Dec-2006
# Posted on: 29-Dec-2013 00:39:44   

Hi,

I use Self Servicing. Have the latest version of llblgen.

When I try to create a new entity in self servicing, I get the following error:

De type-initialisatiefunctie voor SD.LLBLGen.Pro.ORMSupportClasses.EntityCore`1 heeft een uitzondering veroorzaakt.

(type initialization for ... has caused an exception).

With the following stacktrace:

SD.LLBLGen.Pro.ORMSupportClasses.EntityCore`1..ctor(Boolean performsPersistenceLogic, String name) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Core\EntityCore.cs:regel 259 bij SD.LLBLGen.Pro.ORMSupportClasses.EntityBase..ctor(String name) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\EntityBase.cs:regel 87 bij HITc.SCS.EntityClasses.CommonEntityBase..ctor(String name) in e:\BRITS\DataAccessLayer\SCS\Domain\EntityClasses\CommonEntityBase.cs:regel 48 bij HITc.SCS.EntityClasses.StockyardLocationEntity..ctor() in e:\BRITS\DataAccessLayer\SCS\Domain\EntityClasses\StockyardLocationEntity.cs:regel 88 bij SCSTest.Program.Main(String[] args) in e:\BRITS\SCSTest\SCSTest\Program.cs:regel 23

What could cause this? Where to look for a solution?

(allthough there is a reference to c:\Myprojects... in the exception stacktrace, I do not use or have such a library on my PC)

The following code shows what I'm doing. An exception is thrown on the new StockyardLocationEntity.

try
                        {
                            StockyardLocationEntity sy = new StockyardLocationEntity();

                            if (x <= 75)
                            {
                                sy.IdType = 1;
                            }
                            else
                            {
                                sy.IdType = 2;
                            }

                            sy.IdZone = (i + 1);
                            sy.IdLocation = (100 * (x + 1)) + y + 1;
                            sy.IdFutureUse = 0;
                            sy.IdCurrentUse = 0;
                            sy.State = 0;
                            sy.Name = "Rij " + (x + 1).ToString() + " kolom " + y.ToString();
                            sy.DateTimeChanged = DateTime.Now;
                            sy.Save();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            return;
                        }
JayBee
User
Posts: 269
Joined: 28-Dec-2006
# Posted on: 29-Dec-2013 09:10:22   

The database connection string was present in the config file, but not in the appsettings sections. When placed in that section, it run fine.