Alexander Schimpf
Alexander Schimpf

Reputation: 2392

Adding a column to a database accessed by a live website using linq to sql

I've got a database (SQL Server) and a live website accessing that database through linq to sql classes. Now, I need to add a column (allowing null values) to one of the tables in that database.

If I add the column to the database first, and update the linq to sql classes afterward, will the old linq to sql data classes cease to work (since the database schema is different)? The last thing I want is for the website to crash as I update the database.

If doing what I described does cause a problem, what's the best way to do this?

Upvotes: 0

Views: 249

Answers (1)

Mohamed Ramadan
Mohamed Ramadan

Reputation: 803

Adding a new column (allows null) to the database schema without refreshing the LinqToSql model will not cause any problems.

LinqToSQL generate parameterized queries on the runtime which will not affected by the new column as soon as it allows null for the insert statement.

Upvotes: 1

Related Questions