static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DapperMapping.Register(); Application.Run(new TelaBibliotecaDev()); //Application.Run(new TelaBibliotecaPrincipal()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.RegisterMappings(); DapperMapping.RegisterDapperMappings(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(opt => { opt.AddDefaultPolicy(bldr => { bldr.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod(); }); }); services.AddMemoryCache(); services.AddAuthorization(); IMapper mapper = AutoMapperConfig.Register(); services.AddSingleton(mapper); services.AddControllers() .AddFluentValidation(f => f.RegisterValidatorsFromAssemblyContaining <Startup>()) .AddJsonOptions(opts => opts.JsonSerializerOptions.PropertyNamingPolicy = null); RegisterServices(services); DapperMapping.RegisterDapperMappings(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var allowedOrigins = Configuration.GetSection("CORS:AllowedOrigins") .GetChildren().Select(c => c.Value).ToArray(); app.UseCors(a => a.WithOrigins(allowedOrigins) .SetPreflightMaxAge(TimeSpan.FromSeconds(3600)) .AllowCredentials() .AllowAnyHeader() .AllowAnyMethod()); app.UseErrorHandling(); app.UseMvc(); app.UseSignalR(routes => { routes.MapHub <ScoreBoardHub>("/api/hub/scoreboard"); // c => c.Transports = HttpTransportType.ServerSentEvents could just do SSE since we only need one way communication }); app.UseSwagger(c => { c.RouteTemplate = "api-docs/{documentName}/scoreboard.json"; }); app.UseSwaggerUI(c => { c.DocumentTitle = "Tarok Scoreboard API"; c.SwaggerEndpoint("/api-docs/v1/scoreboard.json", "Tarok Scoreboard API"); c.DefaultModelsExpandDepth(0); c.EnableFilter(); c.EnableDeepLinking(); c.RoutePrefix = "api-docs"; }); DapperMapping.ConfigureColumnMapping(); }
public static void Initialize() { DapperMapping.ConfigureCustomMapping(); }