本文整理汇总了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);
}
示例2: CreateContainer
public static IServiceContainer CreateContainer()
{
IServiceContainer container = new ServiceContainer();
container.Register<IServiceContainer, ServiceContainer>();
InitializeContainer(container);
container.RegisterControllers(Assembly.GetExecutingAssembly());
container.EnableMvc();
return container;
}
示例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();
}
示例4: RegisterServices
public static void RegisterServices()
{
var container = new ServiceContainer();
WebHandlers.ServiceConfig.RegisterServices(container);
container.RegisterControllers();
container.EnableMvc();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}