// TODO Config: 因為有多個資料庫,所以在註冊時指定名稱,讓 Service 可以透過名稱取得正確的 IDataContextAsync 及 IUnitOfWorkAsync。 public void SetUp(IModuleRegister register) { // 建立 重複使用的 register.RegisterDataContext <DbContext, NorthwindContext>("NorthwindContext"); register.RegisterUnitOfWork <IUnitOfWork, UnitOfWork>("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Accounts>, TrackableRepository <Accounts> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Authorizes>, TrackableRepository <Authorizes> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <AuthTokens>, TrackableRepository <AuthTokens> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Categories>, TrackableRepository <Categories> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Customers>, TrackableRepository <Customers> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Employees>, TrackableRepository <Employees> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <EmployeeTerritories>, TrackableRepository <EmployeeTerritories> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <OrderDetails>, TrackableRepository <OrderDetails> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Orders>, TrackableRepository <Orders> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Products>, TrackableRepository <Products> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Region>, TrackableRepository <Region> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Shippers>, TrackableRepository <Shippers> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Suppliers>, TrackableRepository <Suppliers> >("NorthwindContext"); register.RegisterRepository <ITrackableRepository <Territories>, TrackableRepository <Territories> >("NorthwindContext"); }
public void SetUp(IModuleRegister register) { // TODO Config: 因為有多個資料庫,所以在註冊時指定名稱,讓 Service 可以透過名稱取得正確的 IDataContextAsync 及 IUnitOfWorkAsync。 // 修改這裡3 register.RegisterDataContext <DbContext, NorthwindDbContext>("Northwind"); register.RegisterUnitOfWork <IUnitOfWorkAsync, UnitOfWork>("Northwind"); // register.RegisterDataContext<IDataContextHelper, NorthwindDbContext>("Northwind"); register.RegisterRepository <IRepositoryAsync <Accounts>, Repository <Accounts> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Authorizes>, Repository <Authorizes> >("Northwind"); register.RegisterRepository <IRepositoryAsync <AuthTokens>, Repository <AuthTokens> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Categories>, Repository <Categories> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Customers>, Repository <Customers> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Employees>, Repository <Employees> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Order_Details>, Repository <Order_Details> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Orders>, Repository <Orders> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Products>, Repository <Products> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Region>, Repository <Region> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Shippers>, Repository <Shippers> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Suppliers>, Repository <Suppliers> >("Northwind"); register.RegisterRepository <IRepositoryAsync <Territories>, Repository <Territories> >("Northwind"); register.RegisterRepository <IRepositoryAsync <NLog_Error>, Repository <NLog_Error> >("Northwind"); }