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


C# IServiceCollection.ConfigureDataContext方法代码示例

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


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

示例1: ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {

            services.ConfigureDataContext(Configuration);

            // Register MyShuttle dependencies
            services.ConfigureDependencies();

            //Add Identity services to the services container
            services.AddIdentity<ApplicationUser, IdentityRole>()
                .AddEntityFrameworkStores<MyShuttleContext>()
                .AddDefaultTokenProviders();

            CookieServiceCollectionExtensions.ConfigureCookieAuthentication(services, options =>
            {
                options.LoginPath = new Microsoft.AspNet.Http.PathString("/Carrier/Login");
            });

            // Add MVC services to the services container
            services.AddMvc();

            services
                .AddSignalR(options =>
                {
                    options.Hubs.EnableDetailedErrors = true;
                });

            //Add InMemoryCache
            services.AddSingleton<IMemoryCache, MemoryCache>();
        }
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:30,代码来源:Startup.cs

示例2: ConfigureServices

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var useInMemoryStore = !_Platform.IsRunningOnWindows || _Platform.IsRunningOnMono || _Platform.IsRunningOnNanoServer;

            services.ConfigureDataContext(Configuration, useInMemoryStore);

            // Register dependencies
            services.ConfigureDependencies(Configuration);

            // Add Entity Framework services to the services container.
            services.AddEntityFramework()
                .AddSqlServer()
                .AddDbContext<MyHealthContext>(options =>
                    options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));

            // Add MVC services to the services container.
            services.AddMvc();

            services.AddOptions();
            services.Configure<DefaultUser>(Configuration.GetSection("DefaultUser"));
            services.Configure<Office365Options>(Configuration.GetSection("Data:Office365"));
            services.AddSingleton<IMemoryCache, MemoryCache>();

            // Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
            // You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
            // services.AddWebApiConventions();          
        }
开发者ID:geekpivot,项目名称:HealthClinic.biz,代码行数:28,代码来源:Startup.cs

示例3: ConfigureServices

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var useInMemoryStore = !_Platform.IsRunningOnWindows || _Platform.IsRunningOnMono || _Platform.IsRunningOnNanoServer;

            services.ConfigureDataContext(Configuration, useInMemoryStore);

            // Register dependencies
            services.ConfigureDependencies();

            // Add Identity services to the services container.
            services.AddIdentity<ApplicationUser, IdentityRole>()
                .AddEntityFrameworkStores<MyHealthContext>()
                .AddDefaultTokenProviders();

            services.AddApplicationInsightsTelemetry(Configuration);

            // Add MVC services to the services container.
            services.AddMvc();

            services.AddCaching();

            services.AddSession();

            services.AddAuthorization(Policies.Configuration);
        }
开发者ID:Sirikon,项目名称:HealthClinic.biz,代码行数:26,代码来源:Startup.cs

示例4: ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {
            services.ConfigureDataContext(Configuration);

            services.AddIdentity<ApplicationUser, IdentityRole>()
                .AddEntityFrameworkStores<MyShuttleContext>()
                .AddDefaultTokenProviders();

            services.ConfigureDependencies();
            services.AddMvc();
        }
开发者ID:SychevIgor,项目名称:conferences,代码行数:11,代码来源:Startup.cs

示例5: ConfigureServices

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var useInMemoryStore = !_Platform.IsRunningOnWindows || _Platform.IsRunningOnMono || _Platform.IsRunningOnNanoServer;

            services.ConfigureDataContext(Configuration, useInMemoryStore);

            // Register dependencies
            services.ConfigureDependencies();

            // Add Identity services to the services container.
            services.AddIdentity<ApplicationUser, IdentityRole>()
                .AddEntityFrameworkStores<MyHealthContext>()
                .AddDefaultTokenProviders();

            services.AddApplicationInsightsTelemetry(Configuration);

            // Add MVC services to the services container.
            services.AddMvc();

            services.AddCaching();

            services.AddSession();

            services.AddAuthorization(options =>
            {
                options.AddPolicy("Admin", policy =>
                {
                    policy.RequireClaim("ManageUsers", "Allowed");
                    policy.RequireClaim("ManageTenants", "Allowed");
                });

                options.AddPolicy("Tenant", policy =>
                {
                    policy.RequireClaim("ManageTenants", "Allowed");
                });
            });
        }
开发者ID:rodrigobrito,项目名称:HealthClinic.biz,代码行数:38,代码来源:Startup.cs

示例6: ConfigureServices

 public void ConfigureServices(IServiceCollection services)
 {
     services.ConfigureDataContext(Configuration);
     services.ConfigureDependencies();
     services.AddMvc();
 }
开发者ID:ostastny,项目名称:mvc6,代码行数:6,代码来源:Startup.cs


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