If we inserted a new person then this also wouldn’t stop our application from working, unless the new column was set to be NOT NULL, however we wouldn’t be able to fill in that information.
Changing column data types Changing the types in our database could cause our application to stop functioning.
Regenerating our Data Context So, if you are changing the underlying table, updating the Data Context in your system is also required.
In Visual Studio 2008 there are only two ways to update a Data Context.
You can use your own custom logic to override these actions, but the order of submission is orchestrated by a service of the Data Context known as the At this point, any errors detected by the database cause the submission process to stop, and an exception is raised.
All changes to the database are rolled back as if no submissions ever occurred.
Thankfully, all the objects are partial, so you can store all your custom logic in a separate class which will not be affected by this.
However, if you go against this and write your logic in the actual Data Context.class then when you recreate it, you will lose these changes.
If our query was like below, then it wouldn’t cause an exception as Phone would never be called.
However, when inserting data we will always get a Sql Exception even if the column was not populated as Linq will try and insert null into the column.
However, this does not roll back the changes in memory or tracked by the Data Context; those changes will need to be rolled back manually.