Updating database using disconnected architecture

posted by | Leave a comment

When invoking the Submit Changes method, we can specify a Conflict Mode enum value to change the way optimistic concurrency’s conflicts are detected and resolved.Listing 7 And finally the Delete method is implemented similar to the Update method, the only difference is to include the invocation to the Delete On Submit method in the data context (see Listing 8).In this type of concurrency control there is a pre-commit phase, where we check that the state of entities are the same as when we gather from the database system, so we are sure that no other transaction has altered the entities.We can implement this by checking every field in the entity or by creating row version field to track the changes to a particular entity (extending the UPDATE statement with a WHERE clause).This is required for the generation of the UPDATE statement described in the Listing 5.And finally, we need to invoke the Submit Changes method on the data context.In this case, the data integrity is at risk once two transactions work with the same records and updates the changes back to the database where lost updates are possible.

Linq to SQL supports this scenario although we need to know some advanced principles and techniques of database systems because Linq to SQL uses optimistic concurrency managed by the Data Context instances in order to leave the data in a consistent state.

By: John Charles Olamendy Turruellas I’ve been searching in Internet for articles about Linq to SQL and most of the articles are written for connected environments where we have a data context created and the database operations are executed in the data context, but there are common business scenario where we gather data from a context and we move to another context to update the changes to the database such as ASP.

NET Web applications and data transfer using Web services as well as desktop applications when we separate the data access code from the business logic code.

Figure 3 Next step is to bind the text fields to the properties of the Department entity.

Go to the “Data Source” windows and add a new data source (see Figure 4 and Figure 5).

Then the Update Check property enables changing this setting (see Figure 7).

Leave a Reply

lovedatingmarriage com