private System.Data.Entity.DbContext context;// = new DbContext();

        //ICompanyRepository gcompanyRepository;
        public UnitOfWork(System.Data.Entity.DbContext _context, IProductDao _productDao, IOrderDao _orderDao, IShopDao _shopDao, IUserDao _userDao, ILineItemDao _lineItemDao)
        {
            context     = _context;
            productDao  = _productDao;
            orderDao    = _orderDao;
            shopDao     = _shopDao;
            lineItemDao = _lineItemDao;
            userDao     = _userDao;
        }
        public ShopService()
        {
            if (!File.Exists(PropsFile))
            {
                throw new Exception("Properties file not found: " + PropsFile);
            }

            var data = File.ReadAllLines(PropsFile).ToDictionary(row => row.Split('=')[0],
                                                                 row => string.Join("=", row.Split('=').Skip(1).ToArray()));
            var daoType = data["dao"];

            Dao = (daoType == "sql") ? (IShopDao) new SqlShopDao(data["host"], data["user"],
                                                                 data["password"], data["database"]) : new FileDao();
        }
Exemple #3
0
 private ShopService()
 {
     _daoManager = ServiceConfig.GetInstance().DaoManager;
     _shopDao = _daoManager.GetDao(typeof(IShopDao)) as IShopDao;
 }
Exemple #4
0
 private ShopService()
 {
     _daoManager = ServiceConfig.GetInstance().DaoManager;
     _shopDao    = _daoManager.GetDao(typeof(IShopDao)) as IShopDao;
 }
Exemple #5
0
 public ShopLogic(IShopDao shopDao)
 {
     _shopDao = shopDao;
 }