This behavior can be modified by applying the Suppress Db Set Initialization Attribute attribute to either the entire derived context class, or to individual properties on the class.
The Entity Data Model backing the context can be specified in several ways.
– Nick Jun 8 at @Nick, BAD idea, and still wouldn't solve your problem, since that way every class gets its own data context.
The connection to the database ( Db Connection object) is also disposed if it was created is by this context or ownership was passed to this context when this context was created.Developers using Visual Studio can use the Object Relational Designer to develop stored procedures for the same purpose. try catch (Exception e) ' Query the database for the row to be updated. Order ID == 11000 select ord; // Execute the query, and change the column values // you want to change. Ship Via = 2 ' Insert any additional changes to column values. More control over the model used for the Model First approach can be obtained by creating a Db Compiled Model explicitly from a Db Model Builder and passing this model to one of the Db Context constructors.When using the Database First or Model First approach the Entity Data Model can be created using the Entity Designer (or manually through creation of an EDMX file) and then this model can be specified using entity connection string or an Entity Connection object.