Beispiel #1
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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());
        }
Beispiel #5
0
        public void CreateSchemaTest()
        {
            var provider = new DatabaseSessionProvider();

            provider.OpenSession();
            using (var session = provider.GetCurrentSession())
            {
            }
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        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));
            }
        }
Beispiel #8
0
        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));
        }