ADO.NET

Using multiple Object Contexts in a Transaction

The scenario: You have 2 Entity Models, and you need to call operations on the ObjectContext of each of them, the operations should be atomic, in that either both operations should succeed or fail so that your databases are consistent. This is fairly straightforward to accomplish using a TransactionScope. ObjectServices is smart enough to detect if the ObjectContext is in a surrounding TransactionScope and if so,use that scope. NOTE:If a scope is not specified, then ObjectContext by default creates ......

Entity Framework Object Context - AWAITING COMMAND

Now I know that the Entity Framework has a disconnected data access model i.e. connections to the database and opened and closed only when you retrieve data that has not been retrieved or you explicitly request a call to the database or you call SaveChanges on the ObjectContext. I was really surprised to find that inspite of disposing the ObjectContext, there was still an active connection maintained to the database. The following code fragment shows the typical usage for ObjectContext. Right after ......