Oct 2, 2012 at 10:04 AM
Edited Oct 2, 2012 at 10:14 AM
The CreatePersistent methods of the factory classes (ObjectContextFactory, EntityConnectionFactory, DbConnectionFactory) instantiate data endpoints that communicate with an in-memory database instance that can be accessed later, it is not deleted if
the endpoint is dismissed.
The underlying in-memory database instance is identified by a string if it is created by the DbConnectionFactory, or by an entity connection string if it is created by the EntityConnectionFactory or ObjectContextFactory.
EntityConnection entityConnection1 =
using (var ctx = new NorthwindObjectContext(entityConnection1))
// Do changes
EntityConnection entityConnection2 =
using (var ctx = new NorthwindObjectContext(entityConnection2))
// Query changes
In the second "object context block" the query will show the changes you have made in the first one, because the entity connection string is same and references to the sample instance of in-memory database.
By the way, I am going to create a blog post about the differences between CreatePersistent and CreateTransient in the near future.