public static void ConfigureDatabase(this IServiceCollection services, AppConnectionString connectionString) { var dbProvider = DatabaseProviderFactory(services, connectionString); dbProvider.ConfigureAppDatabase(); // dbProvider.ConfigureHangfireDatabase(); //dbProvider.ConfigureSqlKata(); dbProvider.ConfigureFluentMigration(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("AllowCors", builder => { builder.AllowAnyOrigin(); builder.AllowAnyHeader(); builder.AllowAnyMethod(); }); }); services.AddControllers(); services.AddAuthentication(options => { options.DefaultAuthenticateScheme = "JwtBearer"; options.DefaultChallengeScheme = "JwtBearer"; }).AddJwtBearer("JwtBearer", jwtBearerOptions => { jwtBearerOptions.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])), ValidateIssuer = false, ValidateAudience = false, ValidateLifetime = true, ClockSkew = TimeSpan.FromMinutes(5) }; }); services.Configure <QneConnectionSettings>(Configuration.GetSection("ConnectionStrings")); var SqlConfig = new AppConnectionString(Configuration.GetConnectionString("DefaultConnectionString")); services.AddSingleton(SqlConfig); services.AddTransient <ISqlDataAccess, SqlDataAccess>(); services.AddTransient <IUserData, UserData>(); services.AddSingleton <MenuService>(); services.AddTransient <QneDataService>(); services.AddTransient <QneReportService>(); }
public PessoaFisicaFinder(AppConnectionString appConnectionString) { _appConnectionString = appConnectionString; }
public AlunoFinder(AppConnectionString appConnectionString) { _appConnectionString = appConnectionString; }
public CompetenciaFinder(AppConnectionString appConnectionString) { _appConnectionString = appConnectionString; }
public EscolaFinder(AppConnectionString appConnectionString) { _appConnectionString = appConnectionString; }
public Startup(IWebHostEnvironment env, IConfiguration config) { _environment = env; _configuration = config; _connectionStrings = new AppConnectionString(_configuration); }
private static IDatabaseProvider DatabaseProviderFactory(IServiceCollection services, AppConnectionString connectionString) { switch (connectionString.DatabaseType) { case AppConnectionString.SupportedDatabaseTypes.SqlServer: return(new SqlServerDatabaseProvider(services, connectionString.Database)); //case AppConnectionString.SupportedDatabaseTypes.SqLite: // return new SqLiteDatabaseProvider(services, connectionString.Database); default: throw new ArgumentException(nameof(connectionString.DatabaseType)); } }