// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("465f47b3-8d7a-46ee-a81e-e51182c12296"); services.Configure <Secrets.ConnectionStrings>(Configuration.GetSection("ConnectionStrings")); services.Configure <Secrets.Login>(Configuration.GetSection("ConnectionStrings")); // project's DI services.AddSingleton <MyEmail>(); services.AddNodeServices(); Bootstrap.Configure(services, Configuration); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddJsonOptions(options => { options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore; }); services.AddResponseCompression(options => { options.MimeTypes = new[] { // Default "text/plain", // "image/png", "image/jpg", "image/jpeg", "image/jp2", "text/css", "application/javascript", "text/html", "application/xml", "text/xml", "application/json", "text/json", "font", "font/woff2", "font/woff", "image/x-icon", // Custom "image/svg+xml", "script" }; options.EnableForHttps = true; }); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Bootstrap.Configure(); using (var ctx = new DriverLicenseStoreContext()) { ctx.Database.Initialize(false); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { 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; }); Bootstrap.Configure(services, Configuration.GetConnectionString("DefaultConnection")); services.AddMvc(config => config.Filters.Add(typeof(CustomExceptionFilter))) .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public void Configuration(IAppBuilder appBuilder) { appBuilder.InitializeGraphite(x => { Bootstrap.Configure(x); x.IncludeTypeAssembly <Startup>(); }); // Manually setup Web Api //var httpConfiguration = new HttpConfiguration(); //httpConfiguration.Routes.MapHttpRoute(...); //appBuilder.UseWebApi(httpConfiguration); //appBuilder.InitializeGraphite(httpConfiguration); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock); BootstrapSupport.BootstrapBundleConfig.RegisterBundles(System.Web.Optimization.BundleTable.Bundles); Bootstrap.Configure(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Application.Add(SessionUtils.APPLICATION_COMPANY_NAME, CompanyService.Instance.getCompanyName()); Application.Add(SessionUtils.APPLICATION_SYSTEM_NAME, CompanyService.Instance.getSystemName()); Application.Add(SessionUtils.APPLICATION_PERMISSIBLES_CONTROLLERS_ACTIONS, SecurityService.Instance.getPermissiblesControllerAction()); Bootstrap.Configure(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { 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.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); //services.AddProgressiveWebApp(); Bootstrap.Configure(services); }
protected void Application_Start() { Bootstrap.Configure(); SimpleMembership.Register(); AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); BootstrapEditorTemplatesConfig.RegisterBundles(); //Add my MVC Provider ModelBinderProviders.BinderProviders.Add(new EFModelBinderProviderMvc()); }
protected override void OnStartup(StartupEventArgs e) { CultureInfo cultureInfo = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; Bootstrap bootstrap = new Bootstrap(); bootstrap.Configure(new List <Registry> { new TournamentManagerRegistry(), new ViewRegistry() }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); Bootstrap.Configure(services, Configuration); services.AddCors(options => { options.AddPolicy( "default", builder => builder .AllowAnyHeader() .AllowAnyMethod() .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowCredentials()); }); }
private static ServiceContainer ConfigureDependencyResolver(HttpConfiguration httpConfig) { var container = new ServiceContainer(); // Other Bootstrap.Configure(container); // Api container.Register <ICurrentUserProvider, CurrentUserProvider>(new PerRequestLifeTime()); container.Register <IUrlProvider, UrlProvider>(new PerRequestLifeTime()); container.Register(sf => HttpContext.Current.Request, new PerRequestLifeTime()); container.RegisterApiControllers(typeof(ApiControllerBase).Assembly); container.EnableWebApi(httpConfig); return(container); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Bootstrap.Configure(services); services.AddControllers(); // compression services.AddResponseCompression(); services.AddSwaggerGen(config => { config.SwaggerDoc("v1", new OpenApiInfo { Title = "Dapper.Build", Version = "v1" }); }); }
protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.RouteExistingFiles = true; var configuration = GlobalConfiguration.Configuration; configuration.MapHttpAttributeRoutes(); configuration .InitializeGraphite(x => { Bootstrap.Configure(x); x.IncludeTypeAssembly <Global>(); }); configuration.EnsureInitialized(); }
protected void Application_Start() { //Make JSON be the default format sent back GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock); BootstrapSupport.BootstrapBundleConfig.RegisterBundles(System.Web.Optimization.BundleTable.Bundles); Bootstrap.Configure(); CorsConfig.Configure(); }
public void BootstrapTest() { var bootstrap = new Bootstrap(); bootstrap.Configure(new List <Registry> { new TournamentManagerRegistry(), new ViewRegistry() }); ITestService testService = ObjectFactory.GetInstance <ITestService>(); Assert.IsNotNull(testService); bool result = testService.ItIsWorking(); Assert.IsTrue(result); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Bootstrap.Configure(services, Configuration.GetConnectionString("DefaultConnection")); services.AddMvc() .AddJsonOptions(options => { options.SerializerSettings.Formatting = Formatting.Indented; }); // Register the Swagger generator, defining one or more Swagger documents services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Spray Arts API", Version = "v1" }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
protected void Application_Start() { log4net.Config.XmlConfigurator.Configure(); log.Info("Application starting..."); AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Database.SetInitializer(new DropCreateDatabaseIfModelChanges <CarbontallyContext>()); Initializer.InitializeSimpleMemberShip(); ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory()); // TwitterBootstrapMVC config. Bootstrap.Configure(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Bootstrap.Configure(services, Configuration.GetConnectionString("DefaultConnection")); /* services.AddDbContext<ApplicationDbContext>(options => * options.UseSqlServer( * Configuration.GetConnectionString("DefaultConnection"))); * services.AddDefaultIdentity<IdentityUser>() * .AddDefaultUI(UIFramework.Bootstrap4) * .AddEntityFrameworkStores<ApplicationDbContext>(); */ services.AddControllersWithViews(); services.AddRazorPages(); services.AddAuthorization(option => { option.AddPolicy("SomenteGestores", policy => policy.RequireClaim("Cargo", "Administrador")); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.Options.StartupTimeout = new TimeSpan(0, 5, 00); spa.UseAngularCliServer(npmScript: "start"); } }); MigrationsDb(app); Bootstrap.Configure(app, env); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("9e5cc6db-d8d8-49c5-aa18-d60b4d06196b"); // string hostCors = Configuration.GetSection("ConnectionStrings")["Cors"]; services.AddCors(options => { options.AddPolicy(RicardoGaefkeCors, builder => { builder .WithOrigins( "https://localhost:5050", "https://localhost:5055", "https://localhost:5060", "https://www.ricardogaefke.com", "https://login.ricardogaefke.com", "https://ci.ricardogaefke.com" ) .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); } ); }); // project's DI services.AddSingleton <MyEmail>(); Bootstrap.Configure(services, Configuration); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.AddControllers(); services.AddSwaggerDocument(); }
protected void Application_Start() { try { Bootstrap.Configure(); AreaRegistration.RegisterAllAreas(); // this returns the instance of the cache repo for use in other filters var repo = RepositoryConfig.Register(GlobalConfiguration.Configuration); FormatterConfig.RegisterFormatters(GlobalConfiguration.Configuration.Formatters); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); } catch (Exception ex) { //Send to rollbar when we get it implemented throw; } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Bootstrap.Configure(services, Configuration.GetConnectionString("DefaultConnection")); 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.AddDbContext<ApplicationDbContext>(options => * options.UseSqlServer( * Configuration.GetConnectionString("DefaultConnection"))); * services.AddDefaultIdentity<IdentityUser>() * .AddDefaultUI(UIFramework.Bootstrap4) * .AddEntityFrameworkStores<ApplicationDbContext>(); */ services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddAuthorization(option => { option.AddPolicy("SomenteGestores", policy => policy.RequireClaim("Cargo", "Administrador")); }); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { Bootstrap.Configure(app, env); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("b67197a1-4fac-4177-a4e7-c42f808c7abd"); services.AddCors(options => { options.AddDefaultPolicy(builder => { if (HostingEnvironment.IsDevelopment()) { builder .WithOrigins( "https://localhost:5050", "https://localhost:5055", "https://localhost:5060", "https://localhost:5065" ) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() ; } else { builder .WithOrigins( "https://*.ricardogaefke.com" ).SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() ; } }); }); Bootstrap.Configure(services, Configuration); services.AddNodeServices(); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.Configure <Secrets.ConnectionStrings>(Configuration.GetSection("ConnectionStrings")); services.AddMvc(config => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build() ; config.Filters.Add(new AuthorizeFilter(policy)); }) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddJsonOptions(options => { options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore; }) ; services.AddResponseCompression(options => { options.MimeTypes = new[] { // Default "text/plain", // "image/png", "image/jpg", "image/jpeg", "image/jp2", "text/css", "application/javascript", "text/html", "application/xml", "text/xml", "application/json", "text/json", "font", "font/woff2", "font/woff", "image/x-icon", // Custom "image/svg+xml", "script" }; options.EnableForHttps = true; }); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Bootstrap.Configure(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Bootstrap.Configure(services, Configuration.GetConnectionString("DefaultConnection")); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Bootstrap.Configure(services, Configuration.GetConnectionString("BancoDeDados")); services.AddMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Bootstrap.Configure(services, configuration.GetConnectionString("DefaultConnection")); services.AddMvc(); services.AddControllersWithViews(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <LivrariaContext>(c => c.UseSqlServer(Configuration.GetConnectionString("SQLServer"))); services.AddMvc(option => option.EnableEndpointRouting = false) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddCors(); services.AddMediatR(typeof(Startup)); services.AddScoped <INotificationHandler <Notifications>, NotifiyHandler>(); services.AddScoped <INotify, Notify>(); Bootstrap.Configure(services); //Aplicando documentação com Swagger services.AddSwaggerGen(x => { x.SwaggerDoc("V1", new OpenApiInfo { Title = "Livraria Theos - Cadastro de Livros", Version = "V1", Description = "Prcesso seletivo para desenvolvedor .net", Contact = new OpenApiContact { Name = "Rafael Miranda", Email = "*****@*****.**" } }); x.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme { Name = "Authorization", Type = SecuritySchemeType.ApiKey, Scheme = "Bearer", BearerFormat = "JWT", In = ParameterLocation.Header, Description = "JWT Authorization header using the Bearer scheme." }); x.AddSecurityRequirement(new OpenApiSecurityRequirement { { new OpenApiSecurityScheme { Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Bearer" } }, new string[] {} } }); }); var key = Encoding.ASCII.GetBytes(Settings.Secret); services.AddAuthentication(option => { option.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; option.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, ValidateIssuer = false, ValidateAudience = false, IssuerSigningKey = new SymmetricSecurityKey(key) }; }); services.AddLogging(loggingBuilder => { loggingBuilder.AddConfiguration(Configuration.GetSection("Logging")); loggingBuilder.AddConsole(); loggingBuilder.AddDebug(); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add your AppInsights ID here to make it globally available // services.AddApplicationInsightsTelemetry("ad26124a-c2fe-415a-859a-1852f7d2c75e"); services.AddCors(options => { options.AddPolicy(RicardoGaefkeCors, builder => { builder .WithOrigins( "https://localhost:5050", "https://localhost:5055", "https://localhost:5060", "https://www.ricardogaefke.com", "https://login.ricardogaefke.com", "https://ci.ricardogaefke.com" ) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() ; } ); }); // project's DI services.AddSingleton <MyEmail>(); services.AddNodeServices(); Bootstrap.Configure(services, Configuration); CookiesAuth.Configure(services, Configuration, HostingEnvironment.IsDevelopment()); services.Configure <Secrets.ConnectionStrings>(Configuration.GetSection("ConnectionStrings")); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddJsonOptions(options => { options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore; }) ; services.AddResponseCompression(options => { options.MimeTypes = new[] { // Default "text/plain", // "image/png", "image/jpg", "image/jpeg", "image/jp2", "text/css", "application/javascript", "text/html", "application/xml", "text/xml", "application/json", "text/json", "font", "font/woff2", "font/woff", "image/x-icon", // Custom "image/svg+xml", "script" }; options.EnableForHttps = true; }); }