The specified value is not an instance of type 'Edm.Decimal'
Posted: Wed 22 Oct 2008 13:18
We are building an application with support for SQL and Oracle. There is one shared conceptual model, and one store model/one mapping model with DB-specific code. Everything is working fine with SQL, but I have an issue with the Oracle provider that I am not able to solve. I'm not quite sure how much it has to do with this Oracle provider, but I don't know where to ask else.
For one table has a primary key as int in SQL and as number in Oracle. In conceptual model, the primary key column is Int32, it works fine with SQL. For oracle, query data works just fine, but when add a record and save the change, I will get this exception:
The specified value is not an instance of type 'Edm.Decimal'
Parameter name: value
at System.Data.Mapping.Update.Internal.TableChangeProcessor.CompileCommands(ChangeNode changeNode, UpdateCompiler compiler)
at System.Data.Mapping.Update.Internal.UpdateTranslator.d__0.MoveNext()
at System.Linq.Enumerable.d__71`1.MoveNext()
at System.Data.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable`1 commands, UpdateTranslator translator)
at System.Data.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
at System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)
at System.Data.Objects.ObjectContext.SaveChanges()
at Bottomline.Transform.Foundation.AuditingData.DataAccess.EntityFramework.AuditDataAccess.Add(IAuditRecord record)
Here are the schemas for my model:
Store:
Conceptual:
Mapping:
If I change the primary key (AUDITID) to Decimal in conceptual model and other IDs keep same as Int32, it works fine. I can create and save a record.
Since these Ids are int in SQL, they can not be mapped to Decimal for SQL.
Hopefully someone can help me out on this one.
For one table has a primary key as int in SQL and as number in Oracle. In conceptual model, the primary key column is Int32, it works fine with SQL. For oracle, query data works just fine, but when add a record and save the change, I will get this exception:
The specified value is not an instance of type 'Edm.Decimal'
Parameter name: value
at System.Data.Mapping.Update.Internal.TableChangeProcessor.CompileCommands(ChangeNode changeNode, UpdateCompiler compiler)
at System.Data.Mapping.Update.Internal.UpdateTranslator.d__0.MoveNext()
at System.Linq.Enumerable.d__71`1.MoveNext()
at System.Data.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable`1 commands, UpdateTranslator translator)
at System.Data.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
at System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)
at System.Data.Objects.ObjectContext.SaveChanges()
at Bottomline.Transform.Foundation.AuditingData.DataAccess.EntityFramework.AuditDataAccess.Add(IAuditRecord record)
Here are the schemas for my model:
Store:
Conceptual:
Mapping:
If I change the primary key (AUDITID) to Decimal in conceptual model and other IDs keep same as Int32, it works fine. I can create and save a record.
Since these Ids are int in SQL, they can not be mapped to Decimal for SQL.
Hopefully someone can help me out on this one.