How does your code base know the Product table exists?
Product table existis always. There are same tables in all databases. Custom columns are added to existing tables.
mgebhard
Why is your project different?
In my case customers can add custom columns to database from application. Application generates
ALTER TABLE product ADD COLUMN customprice TYPE NUMERIC(8,2)
and runs it.
mgebhard
In a database first, changes are made directly to the database using TSQL scripts. At the same time, the code base is updated to handle the database changes.
Using this after adding column to database application should generate new dbcontext.
Should DbContext placed to separate project so that separate dll file is created?
Should application generate new dll file and replace existing one if it adds new column?
Every web site ues different (single) database. This requires running separate application for every web site. Also single-file deplyoment cannot used, dbcontext.dll file should exist on disk.
mgebhard
Why are you unaware of the databases your application require to operate?
For every web site there is only one database containing fixed number of tables. This is know to application. Business rules are continuously changing.
Customers needs to add columns to existing tables without changing application.
Member
53 Points
632 Posts
Re: How to create DbContext at runtime
Jan 26, 2021 02:57 PM|kobruleht|LINK
Product table existis always. There are same tables in all databases. Custom columns are added to existing tables.
In my case customers can add custom columns to database from application. Application generates
ALTER TABLE product ADD COLUMN customprice TYPE NUMERIC(8,2)
and runs it.
Using this after adding column to database application should generate new dbcontext.
Should DbContext placed to separate project so that separate dll file is created?
Should application generate new dll file and replace existing one if it adds new column?
Every web site ues different (single) database. This requires running separate application for every web site. Also single-file deplyoment cannot used, dbcontext.dll file should exist on disk.
For every web site there is only one database containing fixed number of tables. This is know to application. Business rules are continuously changing.
Customers needs to add columns to existing tables without changing application.