protected void Application_Start(object sender, EventArgs e) { //数据库初始化 WingsDbContextInitailizer.Initailizer(); MongoDBBootstrapper.Bootstrap(); CoreService.Initialize(); //映射初始化 log4net.Config.XmlConfigurator.Configure(); //日志初始化 }
protected void Application_Start(object sender, EventArgs e) { ByteartRetailDbContextInitailizer.Initialize(); MongoDBBootstrapper.Bootstrap(); ApplicationService.Initialize(); log4net.Config.XmlConfigurator.Configure(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //repository,service注入 var unityContainer = UnityContainerConfig.RegisterDependency(); GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(unityContainer); //WebAPi注入 MongoDBBootstrapper.Bootstrap(); //MongoDB 在webapi中使用 }
static void Main(string[] args) { var baseAddress = ConfigurationManager.AppSettings["baseAddress"]; ApplicationService.Initialize(); MongoDBBootstrapper.Bootstrap(); using (ServiceHost orderService = new ServiceHost(typeof(OrderService), new Uri(string.Format("{0}/OrderService.svc", baseAddress)))) using (ServiceHost productService = new ServiceHost(typeof(ProductService), new Uri(string.Format("{0}/ProductService.svc", baseAddress)))) using (ServiceHost userService = new ServiceHost(typeof(UserService), new Uri(string.Format("{0}/UserService.svc", baseAddress)))) { orderService.Open(); productService.Open(); userService.Open(); Console.WriteLine("Byteart Retail Services started at: {0}.", DateTime.Now); Console.ReadLine(); Console.WriteLine("Byteart Retail Services stopped at: {0}.", DateTime.Now); orderService.Close(); productService.Close(); userService.Close(); } }