protected void AndWhenProjecting() { using (var session = _sessionFactory.Create()) { var repo = new RepositoryLinq <MyEntity, int>(session); _projectedItem = repo.Select <ProjectedItem>(m => m.Id == 1); } }
protected void AndWhenQueryingByName() { using (var session = _sessionFactory.Create()) { var repo = new RepositoryLinq <MyEntity, int>(session); _whereQueryByName = repo .Where(m => m.Name == "Name 2") .FirstOrDefault(); } }
protected void AndWhenDeleting() { using (var session = _sessionFactory.Create()) { var repo = new Repository <MyEntity, int>(session); repo.DeleteById(1); } using (var session = _sessionFactory.Create()) { var repo = new RepositoryLinq <MyEntity, int>(session); _deletedEntity = repo.Get(1); } }
protected void AndWhenUpdating() { using (var session = _sessionFactory.Create()) { var repo = new Repository <MyEntity, int>(session); var result = repo.Get(1); result.Name = "Updated Name"; repo.Update(result); } using (var session = _sessionFactory.Create()) { var repo = new RepositoryLinq <MyEntity, int>(session); _updatedResult = repo.Where(m => m.Name == "Updated Name").FirstOrDefault(); } }