public async Task ExpImpWithNulls() { var em1 = await TestFns.NewEm(_serviceName); var queryOptions = new QueryOptions(FetchStrategy.FromServer, MergeStrategy.OverwriteChanges); var q0 = new EntityQuery <Customer>().Where(c => c.CompanyName != null && c.City != null) .With(MergeStrategy.OverwriteChanges); var r0 = (await em1.ExecuteQuery(q0)).ToList(); Assert.IsTrue(r0.Count > 2); r0[0].CompanyName = null; r0[1].City = null; var exportedEntities = em1.ExportEntities(null, false); var em2 = new EntityManager(em1); em2.ImportEntities(exportedEntities); var ek0 = r0[0].EntityAspect.EntityKey; var ek1 = r0[1].EntityAspect.EntityKey; var e0 = em2.FindEntityByKey <Customer>(ek0); Assert.IsTrue(e0.CompanyName == null, "company name should be null"); Assert.IsTrue(e0.EntityAspect.EntityState.IsModified()); var e1 = em2.FindEntityByKey <Customer>(ek1); Assert.IsTrue(e1.City == null, "city should be null"); Assert.IsTrue(e1.EntityAspect.EntityState.IsModified()); em2.AcceptChanges(); var exportedEntities2 = em2.ExportEntities(null, false); em1.ImportEntities(exportedEntities2, new ImportOptions(MergeStrategy.OverwriteChanges)); Assert.IsTrue(em1.GetChanges().Count() == 0); }
public async Task ExpImpWithNulls() { var em1 = await TestFns.NewEm(_serviceName); var queryOptions = new QueryOptions(FetchStrategy.FromServer, MergeStrategy.OverwriteChanges); var q0 = new EntityQuery<Customer>().Where(c => c.CompanyName != null && c.City != null) .With(MergeStrategy.OverwriteChanges); var r0 = (await em1.ExecuteQuery(q0)).ToList(); Assert.IsTrue(r0.Count > 2); r0[0].CompanyName = null; r0[1].City = null; var exportedEntities = em1.ExportEntities(null, false); var em2 = new EntityManager(em1); em2.ImportEntities(exportedEntities); var ek0 = r0[0].EntityAspect.EntityKey; var ek1 = r0[1].EntityAspect.EntityKey; var e0 = em2.FindEntityByKey<Customer>(ek0); Assert.IsTrue(e0.CompanyName == null, "company name should be null"); Assert.IsTrue(e0.EntityAspect.EntityState.IsModified()); var e1 = em2.FindEntityByKey<Customer>(ek1); Assert.IsTrue(e1.City == null, "city should be null"); Assert.IsTrue(e1.EntityAspect.EntityState.IsModified()); em2.AcceptChanges(); var exportedEntities2 = em2.ExportEntities(null, false); em1.ImportEntities(exportedEntities2, new ImportOptions(MergeStrategy.OverwriteChanges)); Assert.IsTrue(em1.GetChanges().Count() == 0); }