This discussion is archived
14 Replies Latest reply: Oct 19, 2012 5:21 AM by 964795 RSS

Rebuild edmx after adding edmmapping section in the app.config

964795 Newbie
Currently Being Moderated
The question is in the title.

In order to remap Oracle Data type / EDMX, I add known section in the app.config :

+<oracle.dataaccess.client>+
+<settings>+
+<add name="bool" value="edmmapping number(2,0)" />+
+</settings>+
+</oracle.dataaccess.client>+

Then I get the famous Error 2019 :
*Error 2019: Member Mapping specified is not valid. The type 'Edm.Int16[Nullable=True,DefaultValue=]' of member 'MY_BOOLEAN_COLUMN_NAME' in type 'Model.MY_TABLE_NAME' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=1,Scale=0]' of member 'MY_BOOLEAN_COLUMN_NAME' in type 'Model.Store.MY_TABLE_NAME'.*

I try all I can read about this error but anything works.
The only way to have good result is to add a new edmx file >>> but i don't want to restart from the beginning and rebuild manually my entire edmx file !!!

Is exist a method to fix an existing edmx file after adding <oracle.dataaccess.client> section ?
  • 1. Re: Rebuild edmx after adding edmmapping section in the app.config
    Tridus Journeyer
    Currently Being Moderated
    Not that I've found. I can't even get it to recognize those settings when I build it the first time. I need to go into the designer and change the incorrectly set columns to their proper boolean value. After I do that once, it works fine.

    It's annoying, because it worked properly for me in beta 2.
  • 2. Re: Rebuild edmx after adding edmmapping section in the app.config
    964795 Newbie
    Currently Being Moderated
    it's really unproductive !!
    It's not a problem when you have 2 tables in your edmx but when you have hundreds, it's another story !!
  • 3. Re: Rebuild edmx after adding edmmapping section in the app.config
    Tridus Journeyer
    Currently Being Moderated
    Tell me about it.
  • 4. Re: Rebuild edmx after adding edmmapping section in the app.config
    15208 Explorer
    Currently Being Moderated
    It's an expected error.

    In your case, the CSDL section of the edmx file already has Type="Int16" for the column.
    That's because number(1, 0) is mapped to Int16 by default.

    After the data model is already generated and you change the mapping to Boolean. At runtime
    EF calls the provider's GetEdmType() and it returns Boolean accordingly (because your config file
    indeed has such new mapping). But your edmx is still using Type="Int16" for the column.
    Therefore an error occurs.

    If you don't want to regenrate the model, you may manually update the type mapping in the CSDL
    accordingly, i.e. change Type="Int16" to Type="Boolean" for the column.

    It's highly recommanded that regenerate the data model (and hence to have a new edmx) whenever
    the mapping has changed in the config file.

    Manual change is prone to mistake and may not be faster than regeneration.

    Another approach is double-click on the edmx file, manually delete table(s) from the designer page, save
    the edmx file, then use "Update Model from Database..." to select the table(s) again to update the model.
    In this case, the edmx file will have the new mapping for the table(s) you have just updated.
    Basically, you are doing partial regeneration. Time is saved on Views, SPs, and those unaffected tables in the model.

    Edited by: shsu on Oct 5, 2012 4:08 PM
  • 5. Re: Rebuild edmx after adding edmmapping section in the app.config
    Tridus Journeyer
    Currently Being Moderated
    shsu, that never works for me.

    If I change the config and generate a new model (or set the config before creating any models), I still get a model with int16 as the value. The only thing I've found that works is to change it manually after the fact.
  • 6. Re: Rebuild edmx after adding edmmapping section in the app.config
    15208 Explorer
    Currently Being Moderated
    Hi Tridus,
    The issue you experienced seems to be opposite.
    When the timestamp of the config file has changed, the content of the config file should be re-read and used.
    Unless for some reason the path of the config file at that time is incorrect or unknown to ODT, which privdes
    ODP with the info, the new mapping should be used by ODP in its GetEdmType().

    Can you exit Visual Studio, reopen the solution/project, and then try again?
    Have you tried 11.2.0.3 ODAC Rel 5?
  • 7. Re: Rebuild edmx after adding edmmapping section in the app.config
    Tridus Journeyer
    Currently Being Moderated
    I've done it about a dozen times in several projects, using the first release and Rel 5, in VS 2010 SP1 and 2012. Same thing every time. It worked as described for me in beta 2, broke in beta 3, and hasn't worked in any version since. (I've recently formatted and reinstalled everything from scratch, so its not a lingering beta issue.)

    What config file is it looking for? I'm putting things in the project's App.config where the .edmx is, but it never picks that up until runtime.

    I'm not the only person who has reported the issue here, just the most persistent. :) So I know there's some combination of factors that makes it not work and just haven't figured out what it is yet. When I'm back in the office on Monday I'll try to whip up the simplest test case I can.
  • 8. Re: Rebuild edmx after adding edmmapping section in the app.config
    Tridus Journeyer
    Currently Being Moderated
    Alright. Fired up VS 2012 today and did the following:

    - New Project, C# Forms App
    - Added an App.config file using Add new item. Put the following into it:
    <oracle.dataaccess.client>
    <settings>
    <add name="bool" value="edmmapping number(1,0)" />
    </settings>
    </oracle.dataaccess.client>

    - Closed and reopened the solution.
    - Opened up Server Explorer and opened the connection I want to use.
    - Added a new EDMX model, from the database. Picked one table.
    - number(1,0) is mapped to int16 in the model. Running the project and trying to create a context results in an error due to the mapping not being correct (it expects bool).

    The configuration is being picked up at runtime and totally ignored at design time. I'm also finding that in VS 2012 it doesn't reliably create a connection string in app.config. The first time around I didn't get one, but when I set the project build to x86 instead of AnyCPU (I only have the 32 bit client) and then told it to update from database, it prompted me again for the connection and saved it that time.

    Results in VS 2010 are identical in the model, I still get int16 for number(1,0). It did create the connection string as expected though.
  • 9. Re: Rebuild edmx after adding edmmapping section in the app.config
    Tridus Journeyer
    Currently Being Moderated
    Another update on this. I wiped out all my Oracle clients and just installed the developer tools version. Now the mappings work as expected. Really not sure why that made it happy, but it is.
  • 10. Re: Rebuild edmx after adding edmmapping section in the app.config
    Tridus Journeyer
    Currently Being Moderated
    Me again. Sigh. I reinstalled the "fat" 11.2.0.3 client after this test, since we use that one for other things and it's what the production environment has. It's in another home from the developer tools, but as soon as I installed it and then tried updating the model I'd just created to add another table, the mappings broke again and things are coming up as Int16.

    Seems like that version and the developer tools version don't play nice with each other when they're both on the same machine, even in different homes.
  • 11. Re: Rebuild edmx after adding edmmapping section in the app.config
    964795 Newbie
    Currently Being Moderated
    I'm in the same case.
    I use another Oracle client for our release version of our application and i've installed the new version (Rel.5) for R&D !
    I must uninstalled the old version ?!
    It's really annoying !
  • 12. Re: Rebuild edmx after adding edmmapping section in the app.config
    964795 Newbie
    Currently Being Moderated
    Hope Oracle Support read this forum...
    For information i work also with 32bit Oracle client and a x64 workstation.
  • 13. Re: Rebuild edmx after adding edmmapping section in the app.config
    nswandel Newbie
    Currently Being Moderated
    I am in the same boat! It seems like core functionality and it only works in the beta 2 version. I think I am going to just accept the int16 default mapping and handle conversion in the code. Not very elegant but I have had enough pain. I am very disappointed that Oracle does not seem very interested in addressing the issue. This has been out there for a long time and no fix, bewildering!

    Before I go and make the same type of code change over and over and over.... Has anyone made any progress?
  • 14. Re: Rebuild edmx after adding edmmapping section in the app.config
    964795 Newbie
    Currently Being Moderated
    Hi,
    One of my contact give me some news that seem to be good.
    Oracle says that entity is a young techno and evolves quickly.
    With Oracle 12c, a new major release ODAC will be released. It will be compatible 11G and it will cover more Entity Functionnalities.
    Wait and see.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points