public virtual void TestRefreshIsUnaffectedByPrefetchingBehavior() { IExtObjectContainer oc1 = Db(); IExtObjectContainer oc2 = OpenNewSession(); oc1.Configure().ClientServer().PrefetchDepth(1); oc2.Configure().ClientServer().PrefetchDepth(1); try { PrefetchConfigurationTestCase.Item itemFromClient1 = new PrefetchConfigurationTestCase.RootItem (new PrefetchConfigurationTestCase.Item()); oc1.Store(itemFromClient1); oc1.Commit(); itemFromClient1.child = null; oc1.Store(itemFromClient1); PrefetchConfigurationTestCase.Item itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem )RetrieveOnlyInstance(oc2, typeof(PrefetchConfigurationTestCase.RootItem))); Assert.IsNotNull(itemFromClient2.child); oc1.Rollback(); itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem)RetrieveOnlyInstance(oc2 , typeof(PrefetchConfigurationTestCase.RootItem))); oc2.Refresh(itemFromClient2, int.MaxValue); Assert.IsNotNull(itemFromClient2.child); oc1.Commit(); itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem)RetrieveOnlyInstance(oc2 , typeof(PrefetchConfigurationTestCase.RootItem))); Assert.IsNotNull(itemFromClient2.child); oc1.Store(itemFromClient1); oc1.Commit(); oc2.Refresh(itemFromClient2, int.MaxValue); itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem)RetrieveOnlyInstance(oc2 , typeof(PrefetchConfigurationTestCase.RootItem))); Assert.IsNull(itemFromClient2.child); } finally { oc2.Close(); } }
public virtual void TestRefreshIsUnaffectedByPrefetchingBehavior() { IExtObjectContainer oc1 = Db(); IExtObjectContainer oc2 = OpenNewSession(); oc1.Configure().ClientServer().PrefetchDepth(1); oc2.Configure().ClientServer().PrefetchDepth(1); try { PrefetchConfigurationTestCase.Item itemFromClient1 = new PrefetchConfigurationTestCase.RootItem (new PrefetchConfigurationTestCase.Item()); oc1.Store(itemFromClient1); oc1.Commit(); itemFromClient1.child = null; oc1.Store(itemFromClient1); PrefetchConfigurationTestCase.Item itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem )RetrieveOnlyInstance(oc2, typeof(PrefetchConfigurationTestCase.RootItem))); Assert.IsNotNull(itemFromClient2.child); oc1.Rollback(); itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem)RetrieveOnlyInstance(oc2 , typeof(PrefetchConfigurationTestCase.RootItem))); oc2.Refresh(itemFromClient2, int.MaxValue); Assert.IsNotNull(itemFromClient2.child); oc1.Commit(); itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem)RetrieveOnlyInstance(oc2 , typeof(PrefetchConfigurationTestCase.RootItem))); Assert.IsNotNull(itemFromClient2.child); oc1.Store(itemFromClient1); oc1.Commit(); oc2.Refresh(itemFromClient2, int.MaxValue); itemFromClient2 = ((PrefetchConfigurationTestCase.RootItem)RetrieveOnlyInstance(oc2 , typeof(PrefetchConfigurationTestCase.RootItem))); Assert.IsNull(itemFromClient2.child); } finally { oc2.Close(); } }