I need to add a set of columns to all of my database's tables (SQL Server).
I have generated my database using Code First migrations in Entity Framework 6.
Is it possible to add all these columns to all of my tables at once ? For instance, by overriding the OnModelCreating method with some specific code ?
Or do I have to add these columns to each of my Models used to update the database ?
Thank you in advance for your help !
I found the solution, thanks to Muthu.
To automatically add those "common columns" to all my tables, I just had to create a "Base Model" containing these columns, and make all of my models inherit from it.
This avoids repeatedly adding the columns to each Model as properties, and looks cleaner I believe.
I suggest to do it like this: