public void SaveValidationRequest(MailValidationRequest request) { Require.NotNull(request, nameof(request)); var session = _sessionProvider.GetCurrentSession(); session.Save(request); }
public void SavePasswordChangeRequest(PasswordChangeRequest request) { Require.NotNull(request, nameof(request)); var session = _sessionProvider.GetCurrentSession(); session.Save(request); }
public int GetCountOfEntities(Expression <Func <T, bool> > criteria = null) { var session = _sessionProvider.GetCurrentSession(); return(criteria == null ? session.Query <T>().ToList().Count : session.Query <T>().Where(criteria).ToList().Count); }
public IEnumerable <ProjectMembership> GetAllProjectMemberships(Expression <Func <ProjectMembership, bool> > predicate = null) { var session = _sessionProvider.GetCurrentSession(); return(predicate == null ? session.Query <ProjectMembership>().ToList() : session.Query <ProjectMembership>().Where(predicate).ToList()); }
public void CreateSchemaTest() { var provider = new DatabaseSessionProvider(); provider.OpenSession(); using (var session = provider.GetCurrentSession()) { } }
public int CreateAccount(Account account) { Require.NotNull(account, nameof(account)); var session = _sessionProvider.GetCurrentSession(); var savedAccountId = (int)session.Save(account); // todo: perform check for NRE return(savedAccountId); }
public void DistrubuteEvent(Event @event, DistributionPolicy distributionPolicy) { var session = _sessionProvider.GetCurrentSession(); var eventId = (int)session.Save(@event); foreach (var receiverId in distributionPolicy.ReceiverIds) { var id = session.Save(new Delivery(receiverId, eventId)); } }
public Project[] GetAllProjects(Func <Project, bool> criteria = null) { var session = _databaseSessionProvider.GetCurrentSession(); IEnumerable <Project> allProjects; if (criteria == null) { allProjects = session.Query <Project>(); } else { allProjects = session.Query <Project>().Where(criteria); } return(allProjects.ToArray()); }
public NotificationSetting ReadNotificationSettingByCriteria(Func <NotificationSetting, bool> func) { var session = _sessionProvider.GetCurrentSession(); return(session.Query <NotificationSetting>().SingleOrDefault(func)); }