コード例 #1
0
 private IList <UserTable> RetrieveAllEntitiesFiltered(Func <UserTable, bool> funcOperation)
 {
     using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
     {
         return(_dbContext.UserTables.Where(funcOperation).ToList());
     }
 }
コード例 #2
0
 private IList <UserTable> RetrieveAllEntities()
 {
     using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
     {
         // DatabaseOptionConfigRetriever.DatabaseOptionAppSetting
         return(_dbContext.UserTables.ToList());
     }
 }
コード例 #3
0
 private UserTable FindEntityMatching(Func <UserTable, bool> funcOperation)
 {
     using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
     {
         // DatabaseOptionConfigRetriever.DatabaseOptionAppSetting
         return(_dbContext.UserTables.SingleOrDefault(funcOperation));
     }
 }
コード例 #4
0
 public bool?EntityExistMatchingUsernameAndPassword(string username, string password)
 {
     try
     {
         using (UserAbstractDbContext _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
         {
             return(_dbContext.UserTables.Any(u => u.UserName == username && u.Password == password));
         }
     }
     catch (Exception exception)
     {
         //
     }
     return(null);
 }
コード例 #5
0
 public bool?EntityExistMatchingFunc(Func <UserTable, bool> funcOperation)
 {
     try
     {
         using (UserAbstractDbContext _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
         {
             return(_dbContext.UserTables.Any(funcOperation));
         }
     }
     catch (Exception exception)
     {
         //
     }
     return(null);
 }
コード例 #6
0
 public bool?EntityExistMatchingId(long id)
 {
     try
     {
         using (UserAbstractDbContext _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
         {
             return(_dbContext.UserTables.Any(u => u.Id == id));
         }
     }
     catch (Exception exception)
     {
         //
     }
     return(null);
 }
コード例 #7
0
        public void SaveChange()
        {
            CheckingInternalCollectionValidity();

            try
            {
                using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
                {
                    _dbContext.UserTables.AddRange(_newUsers);
                    _dbContext.SaveChanges();
                    _newUsers.Clear();
                }
            }
            catch (Exception exception)
            {
                throw;
            }
        }
コード例 #8
0
        public void ExecuteDeletion()
        {
            CheckingInternalCollectionValidity();

            try
            {
                using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
                {
                    _dbContext.UserTables.RemoveRange(_userToDelete);
                    _dbContext.SaveChanges();
                    _userToDelete.Clear();
                }
            }
            catch (Exception exception)
            {
                throw;
            }
        }
コード例 #9
0
        public void UpdateChange()
        {
            CheckingInternalCollectionValidity();

            try
            {
                using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
                {
                    MarkCollectionAsUpdate(_dbContext, _usersToUpdate);
                    _dbContext.SaveChanges();
                    _usersToUpdate.Clear();
                }
            }
            catch (Exception exception)
            {
                throw;
            }
        }