Reputation: 1070
I have just migrated to EF6 and here is what is happening. I have done everything suggested in any post on stackoverflow or oracle so I decided to open another question.
1) My Model is in a separated assembly. 2) I have done everything that I was supposed to do to regenerate my Model (deleted the .tt files and refresh my model from DB). 3) After doing that, the new EF seems to be too smart and decided to create all my number(1) fields as boolean. 4) this would cause an enormous rework for me. 5) I decided to added the following entries to web.config in the solution where I have the Model.
<oracle.dataaccess.client>
<settings>
<add name="int16" value="edmmapping number(1,0)" />
<add name="int16" value="edmmapping number(3,0)" />
<add name="int16" value="edmmapping number(4,0)" />
<add name="int32" value="edmmapping number(9,0)" />
<add name="int64" value="edmmapping number(18,0)" />
</settings>
</oracle.dataaccess.client>
I refreshed my model and everything was fine. 6) When I run the app that has reference to my Model Assembly, i get the following exception when opening my connection to the Oracle Database.
error 2019: Member Mapping specified is not valid. The type 'Edm.Int16[Nullable=True,DefaultValue=]' of member 'TRACKATTENDANCEFLAG' in type 'Model.FACILITY' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=1,Scale=0]' of member 'TRACKATTENDANCEFLAG' in type 'Model.Store.FACILITY'.
7) I have added the same entries in the application that uses the Model but it does not matter, I keep getting the same exception.
8) I'm not using the Managed Drive. I'm using the Oracle.DataAccess.Client.
9) Oracle.DataAccess.Client version 2.121.2.0 Oracle.DataAccess.EntityFramework version 6.121.2.0
Does anyone have any ideas? I spent more than 20 hours trying to figure out. I have tried all possible combinations. It is so freaking wrong that Oracle would let me generate my Model but failed during runtime against the exact database.
I appreciate any help
Upvotes: 4
Views: 4660
Reputation: 382
I had a similar problem with the same error message. In my case I was trying to map a number(1,0) column to a boolean and I am using an EDMX file. Previously this project worked and didn't display an error message but with the latest version of oracle developer tools installed and Visual Studio 2019 it started displaying this error message. The project compiled and worked fine but adding this to the web.config removed the error messages as well.
<oracle.manageddataaccess.client>
<version number="*">
<edmMappings>
<edmMapping dataType="number">
<add name="bool" precision="1" />
</edmMapping>
</edmMappings>
</version>
</oracle.manageddataaccess.client>
Upvotes: 0
Reputation: 1327
Had the same issue and tried all solutions I've found. The only one that worked was adding the following code to all my Web.config and app.config files under the <connectionStrings></connectionStrings>
.
<oracle.manageddataaccess.client>
<version number="*">
<edmMappings>
<edmNumberMapping>
<add NETType="int16" MinPrecision="1" MaxPrecision="4" DBType="Number"/>
</edmNumberMapping>
</edmMappings>
</version>
</oracle.manageddataaccess.client>
My setup is:
Upvotes: 10