Using Entity Framework on a legacy database RRS feed

  • Question

  • Hello,

    I am developing an application that needs to use a large legacy database. I would like to use Entity Framework for the data access. I cannot change the database schema, so I will have to make it work with database as it is. This legacy database has some problems; since there are 
    * No keys defined
    * No relationships
    In the database schema.

    When using EdmGen.exe or the entity designer; all the columns in all tables is marked as being a key. Can I edit the model manually in order to:
    * Define the correct keys (as being the columns I know acts as keys)
    * Define some relationships between tables.
    * Fix the casing of entity names (they are all uppercase now, which I would like to get rid of).

    Is there any tools that can help me in this process ? If I must edit the files manually, could you please explain exactly how I can add relationships manually ? And, if I take the time to define these things manually, will it work even though the database schema lacks keys and relationships ?

    Best regards,
    Dennis Riis
    Sunday, October 5, 2008 11:12 AM


  • Well, to fix this, you will need to edit the SSDL in order to define the correct keys for the database model. The designer does not support doing this at this time. You do not need to define relationships between tables, you can do it solely using the designer. Fixing the casing is certainly something the designer can help you do - just rename them on the designer surface or in the property sheets.


    Monday, November 3, 2008 4:50 AM