예제 #1
0
        private void ConfigureLlblgenPro(TenantStore tenantStore)
        {
            foreach (var tenant in tenantStore.GetTenants().Values)
            {
                var connectionString = Configuration.GetConnectionString(tenant.DbContext.ConnectionKey);
                RuntimeConfiguration.AddConnectionString(tenant.DbContext.ConnectionKey, connectionString);
                // Enable low-level (result set) caching when specified in selected queries
                // The cache of a query can be overwritten using property 'OverwriteIfPresent'
                CacheController.RegisterCache(connectionString, new ResultsetCache());
                CacheController.CachingEnabled = true;
            }

            if (WebHostEnvironment.IsProduction())
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Off)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
            }
            else
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Verbose)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));

                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPersistenceExecution", TraceLevel.Verbose);
                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPlainSQLQueryExecution", TraceLevel.Verbose);
            }
        }
예제 #2
0
        private void ConfigureLlblgenPro()
        {
            var dbContextList = DbContextList.DeserializeFromFile(Path.Combine(WebHostEnvironment.ContentRootPath, Program.ConfigurationFolder, $"DbContextList.{WebHostEnvironment.EnvironmentName}.config"));

            foreach (var dbContext in dbContextList)
            {
                var connectionString = Configuration.GetConnectionString(dbContext.ConnectionKey);
                RuntimeConfiguration.AddConnectionString(dbContext.ConnectionKey, connectionString);
                // Enable low-level (result set) caching when specified in selected queries
                // The cache of a query can be overwritten using property 'OverwriteIfPresent'
                CacheController.RegisterCache(connectionString, new ResultsetCache());
                CacheController.CachingEnabled = true;
            }

            //RuntimeConfiguration.SetDependencyInjectionInfo(new[] { typeof(TournamentManager.EntityValidators.UserEntityValidator).Assembly }, new[] { "TournamentManager.Validators" });

            if (WebHostEnvironment.IsProduction())
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Off)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));
            }
            else
            {
                RuntimeConfiguration.ConfigureDQE <SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration>(c => c
                                                                                                           .SetTraceLevel(TraceLevel.Verbose)
                                                                                                           .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory)));

                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPersistenceExecution", TraceLevel.Verbose);
                RuntimeConfiguration.Tracing.SetTraceLevel("ORMPlainSQLQueryExecution", TraceLevel.Verbose);
            }
        }
예제 #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();
            services.AddMvc(options =>
            {
                options.EnableEndpointRouting = false;
            }).AddJsonOptions(options =>
            {
                options.JsonSerializerOptions.IgnoreNullValues = true;
            });

            services.AddResponseCompression(x =>
            {
                x.Providers.Add <GzipCompressionProvider>();
            });

            services.Configure <KestrelServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

            services.Configure <IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

            if (!WebHostEnvironment.IsProduction())
            {
                #region Configuração do Cors CrossOrigins
                services.AddCors(options =>
                {
                    options.AddPolicy("AllowAll",
                                      builder =>
                    {
                        builder
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .DisallowCredentials();
                    });
                });
                #endregion
            }

            #region Configuração do Swagger
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc(
                    "v1",
                    new OpenApiInfo
                {
                    Version        = "v1",
                    Title          = "Api",
                    Description    = "Poc SignalR",
                    TermsOfService = new Uri("https://example.com/terms"),
                    Contact        = new OpenApiContact
                    {
                        Name  = "Uirá Peixoto",
                        Email = string.Empty,
                        Url   = new Uri("https://github.com/uirapeixoto"),
                    }
                }
                    );
            });
            #endregion

            services.AddSignalR();
        }