示例#1
0
 public void Collapse(bool toStart)
 {
     StartContainer.AppendChild(EndContainer);
     StartOffset = 0;
     EndOffset   = 0;
     // Impl
 }
示例#2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ///////////////////////////////////////////////////////////////
            /// Cookie configurations
            //////////////////////////////////////////////////////////////

            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddAuthentication(options =>
            {
                options.DefaultSignInScheme       = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = CookieAuthenticationDefaults.AuthenticationScheme;
            })
            .AddCookie(options =>
            {
                options.AccessDeniedPath = "/AuthWithCookie/Login";
                options.LoginPath        = "/AuthWithCookie/Login";
            });


            //////////////////////////////////////////////////////////////



            services.AddMvc(options =>
                            options.Filters.Add(typeof(CustomExceptionFilter)))
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddHttpContextAccessor();
            services.AddDistributedMemoryCache();
            services.AddSession(options =>
            {
                options.IdleTimeout = TimeSpan.FromMinutes(20);
            });

            string dbConnectionString = this.Configuration.GetConnectionString("dbConnection1");

            services.AddTransient <IDbConnection>((sp) => new SqlConnection(dbConnectionString));

            // Start Registering and Initializing AutoMapper
            Mapper.Initialize(cfg => cfg.AddProfile <MappingProfile>());
            services.AddAutoMapper();
            // End Registering and Initializing AutoMapper

            services.AddSingleton <AuthenticationHandler2>();

            StartContainer.Start(services);
        }
示例#3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            string dbConnectionString = this.Configuration.GetConnectionString("dbConnection");

            services.AddTransient <IDbConnection>((sp) => new SqlConnection(dbConnectionString));

            StartContainer.Start(services);
            AutoMapperConfig(services);
        }