LinqPad 6 EF error on mapping Oracle Tables
Hi, I created a new connection to map some Oracle tables, for some reason EF mapped the table primary key (NUMBER (5.0)) to type Int64, but the other tables that have foreign key for the same field were mapped as Int32. This is generating an error message:
The relationship from 'TSGA_APPLICATION.TSGA_APPLICATION' to 'TSGA_APPLICATION.TSGA_APPLICATION' with foreign key properties {'APPLICATION': int} cannot target the primary key {'APPLATE: long} because it is not compatible. Set the main key or a set of compatible foreign key properties for this relationship.
Follows image of tables and mapping done by EF. Could anyone help me solve?
Comments
NUMBER(5,0) should map to Int32, not Int64. Can you set the query language to SQL and run the following query:
and post the output?
Hi Joe, thanks for the help. Follow the requested output.
Is it possible for you to post the DDL to create the two tables in question, so that I can reproduce the problem?
Yes, I attached the files to this message. Thanks in advance for your help.
I can't recreate the problem with those two tables, but I have an idea of what be the cause. In the query that you ran before, one of the columns (in table TSGA_METODO) has a type number(10,0) instead of number(5,0). Is this a mistake?
Yes, it was a mistake. I asked the Database Administrator to fix it and now the mapping is done correctly. Thank you so much for your help.