Entity getter exception - specific cast is not valid

Posts   
 
    
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 20-Nov-2017 21:32:35   

Hi,

I have this strange error occurring on one of my databases. On the three other databases I have ,it runs just fine.

This is my code


 var entity = new VozidloEntity(Id);
 _adapter.FetchEntity(entity);

 var x = entity.SluzbaId; //throws

The SluzbaId property is of type Int32. The method GetValue in the getter returns in this one case a decimal object. On all other databases it return properly an int object.

The column is NUMBER(9,0) and values are 1 or 2. Default value is 1.

Database Oracle 11 Provider Managed ODP.NET 12.2.1100 LLBLGen Pro 4.2.14.1212

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Nov-2017 07:59:30   
  • Are you sure that the column is NUMERIC(9,0) ?
  • Are your LLBLGen model in sync with the real db datatype? You can see the mapped db type in the Field mappings sub-tab in Entity Editor
  • Does your other three databases use the same table and columns?
David Elizondo | LLBLGen Support Team
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 21-Nov-2017 08:44:36   
  • Are you sure that the column is NUMERIC(9,0) ?
  • Are your LLBLGen model in sync with the real db datatype? You can see the mapped db type in the Field mappings sub-tab in Entity Editor
  • Does your other three databases use the same table and columns?

Yes, I double checked it again. There must be something else.

methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 21-Nov-2017 10:48:30   

Ok, after we reimported the DB it works again simple_smile