Example #1
0
 private IList <UserTable> RetrieveAllEntitiesFiltered(Func <UserTable, bool> funcOperation)
 {
     using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
     {
         return(_dbContext.UserTables.Where(funcOperation).ToList());
     }
 }
Example #2
0
 private IList <UserTable> RetrieveAllEntities()
 {
     using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
     {
         // DatabaseOptionConfigRetriever.DatabaseOptionAppSetting
         return(_dbContext.UserTables.ToList());
     }
 }
Example #3
0
 private UserTable FindEntityMatching(Func <UserTable, bool> funcOperation)
 {
     using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
     {
         // DatabaseOptionConfigRetriever.DatabaseOptionAppSetting
         return(_dbContext.UserTables.SingleOrDefault(funcOperation));
     }
 }
Example #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);
 }
Example #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);
 }
Example #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);
 }
        public void SaveChange()
        {
            CheckingInternalCollectionValidity();

            try
            {
                using (var _dbContext = UserDbFactory.GetUserDbContext(_dbContextType))
                {
                    _dbContext.UserTables.AddRange(_newUsers);
                    _dbContext.SaveChanges();
                    _newUsers.Clear();
                }
            }
            catch (Exception exception)
            {
                throw;
            }
        }
        public void ExecuteDeletion()
        {
            CheckingInternalCollectionValidity();

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

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