static DaoLinker() { dalType = ConfigurationManager.AppSettings["DalType"]; switch (dalType.ToLower()) { case "memory": userDao = new MemoryUserDao(); awardDao = new MemoryAwardDao(); break; case "files": userDao = new FileUserDao(); awardDao = new FileAwardDao(); break; case "database": userDao = new DbUserDao(); awardDao = new DbAwardDao(); imageDao = new DbImageDao(); loginDao = new DbLoginDao(); break; default: throw new ConfigurationErrorsException($"Invalid dalType: {dalType}"); } }
static DependencyResolver() { var DALappSetting = ReadSetting("DAL"); if (DALappSetting == "File") { UserDao = new FileUserDao(); AwardDao = new FileAwardDao(); } else if (DALappSetting == "DB") { UserDao = new DBUserDao(); AwardDao = new DBAwardDao(); AccountDao = new DBAccountDao(); AccountLogic = new AccountLogic(AccountDao); } else { UserDao = new MemoryUserDao(); AwardDao = new MemoryAwardDao(); } UserLogic = new UserLogic(UserDao); AwardLogic = new AwardLogic(AwardDao); }
static DaoProvider() { if (ConfigurationManager.AppSettings["DaoMode"] == "File") { UserDao = new FileUserDao(); AwardDao = new FileAwardDao(); } if (ConfigurationManager.AppSettings["DaoMode"] == "DB") { UserDao = new DBUserDao(); AwardDao = new DBAwardDao(); AccountDao = new DBAccountDao(); } }
static DaoProvider() { string typeOfDal = ConfigurationManager.AppSettings[Entities.Constants.KeyOfDal]; if (typeOfDal.Equals(Entities.Constants.FileDal)) { UserDao = new FileUserDao(); AwardDao = new FileAwardDao(); UserAwardDao = new FileUserAwardDao(); } if (typeOfDal.Equals(Entities.Constants.SqlDal)) { UserDao = new SqlUserDao(); AwardDao = new SqlAwardDao(); UserAwardDao = new SqlUserAwardDao(); ImageDao = new SqlImageDao(); AccountDao = new SqlAccountDao(); } }