Context submitchanges is not updating the database dating in the orthodox church
But, just today, I added a new class to my database.
I then opened up my server explorer, dragged and dropped my new class into the designer for my DBML, and added the public Table field to my data context.
Here is the detach method for the department object which is placed inside the partial class "tbl Department". Because if you have many relationships going out of the tbl Department class then you will be removing those relationships when performing action on the tbl Department object.It would have been nice if the system threw an error saying that it can't submit changes on an object missing a primary key ... I assume that LINQ only work with relational tables that have at least one primary key.otherwise it's very obtuse as to why nothing is happening. So now i have to use the 'old method' which to solve my problem. Although you can attach objects of one Data Context to a different Data Context but when you do this all hell breaks loose.Let's take a look at the example below where I am using a Department Repository class to get the Department by Id.