public static void InitDataBase(bool exec) { GetSession(exec); //初始化表 IRepository repository = UnityIoC.Get <IRepository>(); IAccountService accountService = UnityIoC.Get <IAccountService>(); if (!repository.IsExisted(new Account.By(AccountIdentifier.of("肖斌武")))) //初始化数据 { accountService.CreateAccount("肖斌武", "SDT34200") .SetPassWord("1") .SetRole(Role.All) .SetCanDelete(false); accountService.CreateAccount("王旺玲", "SDT02207") .SetPassWord("1") .SetRole(Role.All) .SetCanDelete(false) .Commit(); } }
public AdminController(IAccountService accountService) { this.accountService = accountService; exemplarServer = UnityIoC.Get <ExemplarServer>(); }
public ExemplarCommand(Exemplar exemplar, IRepository repository) { this.repository = repository; this.exemplar = exemplar; this.sessionService = UnityIoC.Get <IMySessionService>(); }
public MailServer() { this.repository = UnityIoC.Get <IRepository>(); }
public ExemplarServer(IRepository repository) { this.repository = repository; this.sessionService = UnityIoC.Get <IMySessionService>(); this.mailServer = new MailServer(); }
protected void Application_Start() { UnityIoC.RegisterComponents(); //依赖注入 AreaRegistration.RegisterAllAreas(); //注册区域路由 RouteConfig.RegisterRoutes(RouteTable.Routes); //注册全局路由 }