Where I added the last 3 lines as a workaround for unspecified precision in a legacy schema.
If I remove the boolean property the code runs as expected.
Is I add the boolean property (mapped to a number(1,0) column), when the first query runs, I received the following exception:
Schema specified is not valid. Errors:
Nre.msl(82,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.Boolean[Nullable=True,DefaultValue=]' of member 'IsImported' in type 'Model.EntityType1' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=1,Scale=0]' of member 'IMPORTED' in type 'Model.Store.TABLE_1'.
Did you use the custom type mapping specified in your App.Config to generate your data model?
The CSDL file or the CSDL section/content of the edmx file should show number(1, 0) columns are mapped to Boolean type.
Thanks for the confirmation.
Your Entity Data Model was not generated with your custom type mapping.
You may want to remove the entry in <connectionStrings> and regenerate the model with current App.Config.
Then you should not have such issue.
By the way, your custom type mapping seems questionable. I think essentially you will get the following mapping.
I assume you mean that the EDMX was not created after the App.Config changes, which is correct.
The model is created with customized POCO T4s and has been recreated.
How can I update the EDMX manually without recreating it? (What xml changes are required?)
Regarding the mappings:
Does <add name="int32" value="edmmapping number(10,0)" /> mean enabling mapping numbers of precision 1 and above to bool?
If so, I agree, the last three lines are redundant.
However, if these lines
<add name="int32" value="edmmapping number(10,0)" />
<add name="int64" value="edmmapping number(19,0)" />
mean map 10-18 to int32 and 19+ to int64, then I still need the last three lines.
number(p, s) Decimal (where p > 19 and/or s is not 0)
When you have mapped number(1, 0) to Boolean, Int16 mapping range becomes from number(2, 0) to number(5, 0).
When you have mapped number(4, 0) to Int16, Int16 mapping range becomes from number(2, 0) to number(4, 0).
Int32 mapping range becomes from number(5, 0) to number(10, 0) and Int64 is from number(11, 0) to number(19, 0).
When you have mapped number(9, 0) to Int32, Int32 mapping range is from number(5, 0) to number(9, 0) and
Int64 mapping range is from number(10, 0) to number(19, 0).
Regarding "update the EDMX", you may try "Table Mapping" without manually update it.
In your class for the POCO entity, the attribte type should match.
(I removed the restriction I mentioned previously. It's seems the restriction has been lifted.)
Thanks for the reply, I thought that Oracle employees are supposed to have an ace shaped icon.
I tried the following:
1. Explicitly referenced the correct version/platform of Oracle.DataAccess.dll (even though I uninstalled the beta3 prior to installing the release).
2. Deleted the connection string from App.Config
3. Deleted the EDMX
4. Recreated the EDMX
5. Redid all my data type settings (replacing decimal with int32 or int16)
6. Renamed all the classes and properties again
7. Reran template generation
9. Ran test
yet the EDMX still passes validation and I still get the same exception.
(After deleting all boolean properties, running generation, building and running test test passes.)
You can see from the xml sections I previously posted that the definitions and mappings look OK.
If they weren't the validation would fail e.g. when I intentionally change the boolean property's type to Guid I receive the following error during VALIDATION:
Error 2019: Member Mapping specified is not valid. The type 'Edm.Guid[Nullable=True,DefaultValue=]' of member 'IsImported' in type 'MyClass' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=1,Scale=0]' of member 'IMPORTED' in type 'MyTable'.
Whereas when the type matches validation passes and I receive Error 2019 during RUNTIME.
Since the validation passes, but the mapping fails at run time, I figured out it is probably an issue of the ODP.NET reading the wrong app.config file.
I copied the mapping section from the assembly that contains the EDMX and EF context to the test assembly and then ran the tests again.
This fixed the issue._
Could ODP.NET be updated so it can access the EDMX's assembly's app.config and not only the application?
Maintaining these mappings at the application level can cause conflicts if the application has more than one EDMX with different mappings and also requires all applications that consume the library to define internal settings.
Probably not, since that's a .net thing. After you build the project, the application's app.config (or web.config) is the only one that actually gets included. It doesn't bring in the config files of every imported assembly.
Looks like your case is a solution file with multiple projects for Context, Model, and Application (or Test).
Because the Application project is the active (Startup) project. At runtime ODP.NET reads the App.Config of the Application project. But this App.Config only has the connection string and no custom type mapping section, therefore type mapping issue arises.
The custom type mapping section is only in the App.Config for the Context project. Your solution is to copy the custom type mapping section to the App.Config for the Application project.