none
Database with Table Named "Systems" RRS feed

  • Question

  • I am trying to create an entity framework model for an existing database. The problem is there is a table named "Systems". When I add this table to my model, everything breaks because the code generates a class named "System". Even though this class is within a namespace, it breaks all references to the System namespace.

    Is there a way to add this table to the model but map it to a different name or alias it somehow? I cannot change the name in the database.

    Wednesday, January 23, 2013 4:12 PM

Answers

  • Hi,

    in the designer you can change the name of table. WHat problem are you getting in changing the name ?

    You can go in the designer and double click the name of entity in diagram thne it will become editable, then you can edit the name of that table.

    Hope this helps.


    One good question is equivalent to ten best answers.



    • Edited by Shyam Kr Wednesday, January 23, 2013 4:26 PM
    • Marked as answer by IntercareIns Wednesday, January 23, 2013 4:48 PM
    Wednesday, January 23, 2013 4:18 PM

All replies

  • Hi,

    in the designer you can change the name of table. WHat problem are you getting in changing the name ?

    You can go in the designer and double click the name of entity in diagram thne it will become editable, then you can edit the name of that table.

    Hope this helps.


    One good question is equivalent to ten best answers.



    • Edited by Shyam Kr Wednesday, January 23, 2013 4:26 PM
    • Marked as answer by IntercareIns Wednesday, January 23, 2013 4:48 PM
    Wednesday, January 23, 2013 4:18 PM
  • That did the trick. Thank you! Obviously I'm new to EF...this is my first time working with it.

    I had tried a couple of things: creating a view on the table and adding the view to the model, but that doesn't take the relationships with it. I also tried creating a synonym, but it doesn't seem to allow you to add synonyms to the model either.

    Wednesday, January 23, 2013 4:49 PM