I'm trying to write a test and I'm running into an issue if I call SaveChanges on the EntityManager object.
I get the following Exception:
"IdeaBlade.EntityModel.EntityManagerSaveException: This EntityManager is not currently connected - Reconnect before attempting to save."
Am I missing something or is there a work around for this. My DomainModelEntityManager class extends from EntityManager and I pass in false to the constructor so that it can run disconnected.
[TestMethod]
public void TestMyMethod()
{
var mgr = new DomainModelEntityManager(false);
var myObject = new MyClass { ID = 1};
mgr.AttachEntity(myObject);
var myService = new MyService(mgr);
myService.PerformLogicAndSave(myObject);
}
public class MyService{
public MyService(EntityManager myManager){
MyManager = myManager;
}
public void PerformLogicAndSave(MyClass myObject){
//Do Something to myObject
MyManager.SaveChanges();
}
}