locked
Database-First approach for tables without key column RRS feed

  • Question

  • User1904516115 posted

    I am using Entity First Database-first approach for existing database. Few tables don't  not have key column. I am getting below error. There is any way to bypass the Entity Framework behavior for tables those dont have key columns  

    "The table/view TABLE_NAME does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it".

    Saturday, August 31, 2019 5:12 PM

All replies

  • User475983607 posted

    No, tables must have a key.  You can code around this by using raw queries but properly normalizing your table deigns (adding a key) is the recommended approach.

    Saturday, August 31, 2019 6:15 PM