public IdProtectorConverter(IDataProtectionProvider protectionprovider, StringConstants strconsts)
 {
     this.protector = protectionprovider.CreateProtector(strconsts.IdQryStr);
 }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IDataProtectionProvider dataprovider, StringConstants strconsts)
        {
            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.ConstructServicesUsing(type => new IdProtectorConverter(dataprovider, strconsts));
                cfg.CreateMap <BudgetCategoryDTO, BudgetCategory>();
                cfg.CreateMap <BudgetCategory, BudgetCategoryDTO>().ConvertUsing <IdProtectorConverter>();
            });
            app.UseCors("DemoCorsPolicy");
            app.UseAuthentication();

            var context = app.ApplicationServices.GetService <PersonalBudgetContext>();

            TestData.AddTestData(context);

            app.UseMvc();
        }