Entities generated EntityKey bad type for Number(16,0)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
danik
Posts: 3
Joined: Thu 17 Jul 2008 15:30

Entities generated EntityKey bad type for Number(16,0)

Post by danik » Thu 17 Jul 2008 15:51

Hi,
I have some table in DB with its ID of type Number(16,0). It is mapped to Int64 in both ssdl and csdl. But type of value in o.EntityKeyValues[0].Value is double. That is problem for Detach-Atach scenario (for example for 3-layer editing).

Exception:
The type of the key field 'ID' is expected to be 'System.Int64', but the value provided is actually of type 'System.Double'.

Stack:

Code: Select all

   at System.Data.EntityKey.ValidateEntityKey(EntitySet entitySet)
   at System.Data.Objects.ObjectContext.AttachTo(String entitySetName, Object entity)
   at System.Data.Objects.ObjectContext.Attach(IEntityWithKey entity)
Code to reproduce ) note that ID is Number(16,0) in database:

Code: Select all

            using (MyContext myDb = new MyContext())            
            {
                var q = myDb.OBJ; 
                foreach (OBJ o in q)
                {
                    myDb.Detach(o);
                    myDb.Attach(o); //throws exception
Values in watches:
o.EntityKeyValues[0].Value - 100000961438.0 object {double}
o.ID - 100000961438 long

Version of OraDirects: 4.70.37
EF version from SP1 beta3

Any idea?

Thanx,
Danik

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 18 Jul 2008 11:25

Hello, Danik.

Thank you for the bug report. The issue is fixed, look forward for the next build.

Regards, Andrey.

Post Reply