当前位置: 首页>>代码示例>>C#>>正文


C# ServiceContainer.EnableMvc方法代码示例

本文整理汇总了C#中ServiceContainer.EnableMvc方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceContainer.EnableMvc方法的具体用法?C# ServiceContainer.EnableMvc怎么用?C# ServiceContainer.EnableMvc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceContainer的用法示例。


在下文中一共展示了ServiceContainer.EnableMvc方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Register

		public static void Register(ServiceContainer container, HttpConfiguration config)
		{
			container.RegisterControllers();
			container.RegisterApiControllers();

			#region Services
			container.Register<IPluralizeProxy, PluralizeProxy>();
			container.Register(factory => PluralizationService.CreateService(CultureInfo.GetCultureInfo("en")));
			container.Register<ISitemapGenerator, SitemapGenerator>();
			#endregion

			#region Tracing
			container.Register<IDiagnosticTrace, DiagnosticTrace>();
			#endregion

			#region Repositories
			container.Register<IDbContext, NhDbContext>();
			container.Register<IDataRepository<Repository>, DataRepository<Repository>>(new PerScopeLifetime());
			container.Register<IDataRepository<Session>, DataRepository<Session>>(new PerScopeLifetime());
			container.Register<IDataRepository<LogEntry>, DataRepository<LogEntry>>(new PerScopeLifetime());
			#endregion

			container.EnableMvc();
			container.EnablePerWebRequestScope();
			container.EnableWebApi(config);
		}
开发者ID:nHook,项目名称:nH.Web,代码行数:26,代码来源:DIConfig.cs

示例2: CreateContainer

 public static IServiceContainer CreateContainer()
 {
     IServiceContainer container = new ServiceContainer();
     container.Register<IServiceContainer, ServiceContainer>();
     InitializeContainer(container);
     container.RegisterControllers(Assembly.GetExecutingAssembly());        
     container.EnableMvc();
     return container;
 }
开发者ID:Amit-khandelwal,项目名称:Amit_EmployeeFinder,代码行数:9,代码来源:LightInjectWebCommon.cs

示例3: ConfigInjector

 public void ConfigInjector()
 {
     var container = new ServiceContainer();
     container.RegisterAssembly(Assembly.GetExecutingAssembly());
     container.RegisterAssembly("WebDeveloper.DataAccess*.dll");
     container.RegisterAssembly("WebDeveloper.Model*.dll");
     container.RegisterControllers();
     container.EnableMvc();
 }
开发者ID:ChristianUbillus,项目名称:Cibertec_Final_Project,代码行数:9,代码来源:Startup.Injector.cs

示例4: RegisterServices

        public static void RegisterServices()
        {
            var container = new ServiceContainer();

            WebHandlers.ServiceConfig.RegisterServices(container);

            container.RegisterControllers();
            container.EnableMvc();
        }
开发者ID:raskhodchikov,项目名称:room-planner,代码行数:9,代码来源:ServiceConfig.cs

示例5: SetAutoFacContainer

 private static void SetAutoFacContainer()
 {
     var dbcontext = new MvcUserManagementDbContext();
     var container = new ServiceContainer();
     container.RegisterControllers(Assembly.GetExecutingAssembly());
     container.Register<IUnitOfWork>((factory) => new UnitOfWork(dbcontext));
     container.Register(typeof(IRepository<>), typeof(RepositoryBase<>));
     container.Register<IEmployeeRepository, EmployeeRepository>(new PerRequestLifeTime());
     container.EnableMvc();
 }
开发者ID:raghav-rosberg,项目名称:MvcUserManagement,代码行数:10,代码来源:BootStrapper.cs

示例6: Application_Start

 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     var container = new ServiceContainer();
     container.RegisterControllers();
     Container.InitiateContainer(container);
     container.EnableMvc();
 }
开发者ID:madsrangholm,项目名称:GennemsigtigPolitik,代码行数:11,代码来源:Global.asax.cs

示例7: Register

        /// <summary>
        /// Registers main components
        /// </summary>
        /// <param name="config">Http Configuration</param>
        public static void Register(HttpConfiguration config)
        {
            var container = new ServiceContainer();
            container.RegisterApiControllers();

            container.EnablePerWebRequestScope();
            container.EnableWebApi(GlobalConfiguration.Configuration);
            container.EnableMvc();

            // Register Services
            RegisterServices(container);
        }
开发者ID:ryanwoodcox,项目名称:HelloWorld,代码行数:16,代码来源:LightInjectConfig.cs

示例8: SetLightInjectContainer

        private static void SetLightInjectContainer()
        {
            var container = new ServiceContainer();
            container.RegisterControllers(Assembly.GetExecutingAssembly());
            container.Register<IUnitOfWork, UnitOfWork>(new PerScopeLifetime());
            container.Register(typeof(Repository<>), typeof(IRepository<>));
            container.Register<IAccountBO, AccountBO>(new PerScopeLifetime());
            container.Register<IVisitorBO, VisitorBO>(new PerScopeLifetime());
            container.Register<IVisitorDetailsBO, VisitorDetailsBO>(new PerScopeLifetime());
            container.Register<IGenderBO, GenderBO>(new PerScopeLifetime());

            container.EnableMvc();
        }
开发者ID:vipinraturi,项目名称:VisitorManagementSystem,代码行数:13,代码来源:LightInjectDependencyInjector.cs

示例9: Application_Start

        protected void Application_Start()
        {
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new ServiceContainer();

            container.RegisterControllers();
            container.RegisterInstance<IRavenInstance>(RavenInstance.Current);

            container.EnableMvc();
        }
开发者ID:kodkatten,项目名称:CodelessPlate,代码行数:14,代码来源:Global.asax.cs


注:本文中的ServiceContainer.EnableMvc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。