/// <summary> /// Do the merge /// </summary> public void DoMerge() { // Bulk merge an entry // Reset the database using (var dcs2 = new DBModelSession()) { using (var dcs = this.sb.GetContext <DBModelSession>()) { dcs.BulkMerge(new List <CORE_SESSION>() { new CORE_SESSION() { data = "mydata", device = "mydevice", expires = 1646464, id = Guid.NewGuid(), lastrefresh = 54844, started = 4616161, uuid = Guid.NewGuid() } }, options => options.ColumnPrimaryKeyExpression = r => r.id); dcs.SaveChanges(); QueryFilterContextInterceptor interceptor = new QueryFilterContextInterceptor(dcs); dcs.SaveChanges(); } } }
public void TestMethod1() { CurrentMappings currentMappings; Application app; // Here the CORE_USER entity is NOT being ignored currentMappings = new CurrentMappings((modelBuilder) => { modelBuilder.Configurations.Add(new CORE_SESSIONConfiguration()); modelBuilder.Configurations.Add(new CORE_USERConfiguration()); modelBuilder.Filter("test", (CORE_USER b, bool isDeleted) => true, () => false); }); GlobalDBConfiguration config = new GlobalDBConfiguration(); DbConfiguration.SetConfiguration(config); app = new Application(currentMappings); app.ResetDatabase(); app.DoMerge(); // Here we ignore both the entity and the field that has the FK currentMappings = new CurrentMappings((modelBuilder) => { modelBuilder.Configurations.Add(new CORE_SESSIONConfiguration()); modelBuilder.Entity <CORE_SESSION>().Ignore(t => t.fk_core_user); modelBuilder.Ignore <CORE_USER>(); }); ZzzUtils.ClearZzzAndEfCaches(ConnectionBuilder.GetConnectionString()); var dcs = new DBModelSession(); app = new Application(currentMappings); app.DoMerge(); }