c# – Updating Entity Framework Model


How can you organize such logic so that the web page has the ability to add (delete / change) a column of a certain type to the sql table, while dynamically changing the Entity Framework model. Those. the task is to write a page for the administrator who will not work with the code, and on this page you can edit the table. Thank you.


This is not possible at runtime. Your Entity classes contain fields / properties corresponding to the table columns. If a column is added to the table, should fields appear in Entity classes right at runtime? And if the column disappears, what should happen to that (compiled!) Code that uses their corresponding fields?

The goal of the Entity Framework, like any other ORM, is to bring type checking and compile-time safety to the database world. For database administration, ORM is not a suitable tool.

Do not use EF, it is not suitable for your task.

Scroll to Top