Search code examples
c#entity-framework-6ef-database-first

Entity Framework database-first - dynamically adding table to model


I have tables with the same structure but with a letter prefix of every table.

For example:

A_Company, B_Company, C_Company

There is combo box from which the user can select A, B or C, and then the code saves data into the appropriate table.

How can I do this using EF database-first?


Solution

  • I solved this problem adding a column for code prefix and triggers on my base table company for insert update and delete.