public void Fetch_session() { using (var session = _lazySessionFetcher.Session) { var obj1 = new EntityClass1 { Item4 = "Explicit_commit_normal" }; using (var transaction = session.BeginTransaction()) { // arrange session.SaveOrUpdate(obj1); // act transaction.Commit(); // assert obj1.Id .Should() .HaveValue(); } using (session.BeginTransaction()) { var entity = session.Query <EntityClass1>() .First(e => e.Item4 == "Explicit_commit_normal"); entity.ShouldBeEquivalentTo(obj1); } } }
public MethodUpdateString(EntityClass1 entityClass1Object) { entityClass1Object.CustomString1 = "UPDATED"; dbContext.EntityClass1.Add(entityClass1Object); var entity2 = new EntityClass2(); entity2.EntityClass1Id = entityClass1Object.Id; dbContext.EntityClass2.Add(entity2); dbContext.SaveChanges(); }