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


C# IServiceCollection.AddSmartCookies方法代码示例

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


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

示例1: ConfigureServices

 public void ConfigureServices(IServiceCollection services)
 {
     services.AddSmartCookies();
     services.AddMvc()
         .AddMultiTemplateEngine()
         .AddCookieTemplateProvider();
 }
开发者ID:yonglehou,项目名称:dotNETCore-Extensions,代码行数:7,代码来源:Startup.cs

示例2: ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {
            #region Adding Entity Framework v7
            services.AddEntityFramework()
                .AddSqlite()
                .AddDbContext<ChinaTowerContext>(x => x.UseSqlite($"Data source={PlatformServices.Default.Application.ApplicationBasePath}/Database/chinatower.db"));
            #endregion

            #region Adding Identity v3
            services.AddIdentity<User, IdentityRole>(x => 
            {
                x.Password.RequireDigit = false;
                x.Password.RequiredLength = 0;
                x.Password.RequireLowercase = false;
                x.Password.RequireNonLetterOrDigit = false;
                x.Password.RequireUppercase = false;
                x.User.AllowedUserNameCharacters = null;
            })
                .AddEntityFrameworkStores<ChinaTowerContext>()
                .AddDefaultTokenProviders();
            #endregion

            #region Adding Others
            services.AddConfiguration();
            services.AddMvc();
            services.AddSmartCookies();
            services.AddSmartUser<User, string>();
            services.AddAesCrypto();
            services.AddSmtpEmailSender("smtp.ym.163.com", 25, "中国铁塔", "[email protected]", "[email protected]", "123456");
            services.AddWgsDis();
            #endregion
        }
开发者ID:CodeCombLLC,项目名称:ChinaTower,代码行数:32,代码来源:Startup.cs

示例3: ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {
            IConfiguration Configuration;
            services.AddConfiguration(out Configuration);
            var appEnv = services.BuildServiceProvider().GetRequiredService<IApplicationEnvironment>();
            var connStr = "Data source=" + appEnv.ApplicationBasePath + "/" + Configuration["DBFile"] + ";";
            if (connStr.IndexOf('\\') >= 0)
                connStr = connStr.Replace("/", "\\");

            services.AddSmartCookies();

            services.AddJsonLocalization()
                .AddCookieCulture();

            services.AddEntityFramework()
                .AddSqlite()
                .AddDbContext<BlogContext>(options =>
                    options.UseSqlite(connStr));

            services.AddCaching();
            services.AddSession(x => x.IdleTimeout = TimeSpan.FromMinutes(20));

            services.AddMvc()
                .AddTemplate()
                .AddCookieTemplateProvider();
        }
开发者ID:Kagamine,项目名称:YuukoBlog.vNext,代码行数:26,代码来源:Startup.cs

示例4: ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {
            // Add smart cookies
            services.AddSmartCookies();

            // Add entity framework and in-memory storage
            services.AddEntityFramework()
                .AddInMemoryDatabase()
                .AddDbContext<SampleContext>(x => x.UseInMemoryDatabase());

            // Add identity
            services.AddIdentity<Models.User, IdentityRole>(x =>
            {
                x.Password.RequiredLength = 0;
                x.Password.RequireDigit = false;
                x.Password.RequireLowercase = false;
                x.Password.RequireNonLetterOrDigit = false;
                x.Password.RequireUppercase = false;
                x.User.RequireUniqueEmail = false;
                x.User.AllowedUserNameCharacters = null;
            })
                .AddEntityFrameworkStores<SampleContext>()
                .AddDefaultTokenProviders();

            // Add mvc with multi template engine and cookie based template provider
            services.AddMvc()
                .AddTemplate()
                .AddCookieTemplateProvider();

            services.AddSmartUser<User, string>();
        }
开发者ID:CodeComb,项目名称:Extensions,代码行数:31,代码来源:Startup.cs

示例5: ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {
            var _serv = services.BuildServiceProvider();
            var appRoot = _serv.GetRequiredService<IApplicationEnvironment>().ApplicationBasePath;
            
            IConfiguration Configuration;
            services.AddConfiguration(out Configuration);

            if (Configuration["Data:DefaultConnection:Mode"] == "SQLite")
            {
                services.AddEntityFramework()
                    .AddDbContext<vNextChinaContext>(x => x.UseSqlite(Configuration["Data:DefaultConnection:ConnectionString"].Replace("{appRoot}", appRoot)))
                    .AddSqlite();
            }
            else if (Configuration["Data:DefaultConnection:Mode"] == "SqlServer")
            {
                services.AddEntityFramework()
                    .AddDbContext<vNextChinaContext>(x => x.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]))
                    .AddSqlServer();
            }
            else
            {
                services.AddEntityFramework()
                    .AddDbContext<vNextChinaContext>(x => x.UseInMemoryDatabase())
                    .AddInMemoryDatabase();
            }
            
            services.AddIdentity<User, IdentityRole<long>>(x => 
            {
                x.Password.RequireDigit = false;
                x.Password.RequiredLength = 0;
                x.Password.RequireLowercase = false;
                x.Password.RequireNonLetterOrDigit = false;
                x.Password.RequireUppercase = false;
                x.User.AllowedUserNameCharacters = null;
            })
                .AddEntityFrameworkStores<vNextChinaContext, long>()
                .AddDefaultTokenProviders();

            services.AddMvc();
            services.AddSmartUser<User, long>();
            services.AddSmartCookies();
            services.AddAntiXss();
            services.AddSmtpEmailSender("smtp.qq.com", 25, "vNext China", "[email protected]", "911574351", "XXX");
            services.AddAesCrypto();
            services.AddEFNodeProvider<vNextChinaContext>();
            services.AddSignalR();
        }
开发者ID:Jeffiy,项目名称:vnextcn.org,代码行数:48,代码来源:Startup.cs

示例6: ConfigureServices

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddEntityFramework()
                .AddDbContext<MOContext>(x => x.UseSqlite("Data source=mobileoperation.db"))
                .AddSqlite();

            services.AddIdentity<User, IdentityRole>()
                .AddEntityFrameworkStores<MOContext>()
                .AddDefaultTokenProviders();

            services.AddFileUpload()
                .AddEntityFrameworkStorage<MOContext>();

            services.AddMvc();
            services.AddSmartUser<User, string>();
            services.AddSmartCookies();
        }
开发者ID:CodeCombLLC,项目名称:MobileOperation,代码行数:17,代码来源:Startup.cs


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