public DatabaseOperations( SPMiddlewareOptions sPMiddlewareOptions, SwaggerFromSPOptions options, SqlHelper sqlHelper, ILogger <DatabaseOperations> logger, DbConnection dbConnection, ParameterProvider parametersProvider, SerializerResolver serializerResolver, NamingMappingHandler namingMappingHandler, CodeConvention codeConvention, ConfigProvider configProvider, IWebHostEnvironment hostingEnvironment) { this.codeConvention = codeConvention; this.hostingEnvironment = hostingEnvironment; this.sPMiddlewareOptions = sPMiddlewareOptions; this.options = options; this.sqlHelper = sqlHelper; this.logger = logger; this.serializerResolver = serializerResolver; this.dbConnection = dbConnection; this.parametersProvider = parametersProvider; this.namingMappingHandler = namingMappingHandler; entities = configProvider.Entities; }
public DatabaseOperations(Microsoft.Extensions.Configuration.IConfiguration conf, SPMiddlewareOptions sPMiddlewareOptions, SwaggerFromSPOptions options, SqlHelper sqlHelper, ILogger <DatabaseOperations> logger, DbConnection dbConnection, ParameterProvider parametersProvider, NamingMappingHandler namingMappingHandler) { this.sPMiddlewareOptions = sPMiddlewareOptions; this.options = options; this.sqlHelper = sqlHelper; this.logger = logger; this.dbConnection = dbConnection; this.parametersProvider = parametersProvider; this.namingMappingHandler = namingMappingHandler; var ent = conf.GetSection("Entities"); entities = ent.GetChildren() .Select(s => Entity.GetFromSection(s)).ToList(); }
public static void AddGenericBackend(this IServiceCollection services, GenericSP.SPMiddlewareOptions options = null, SwaggerGeneration.SwaggerFromSPOptions swaggerFromSPOptions = null) { services.AddRouting(); services.AddKullDatabaseMetadata(); services.AddSingleton <Model.NamingMappingHandler>(); services.AddSingleton <Filter.IParameterInterceptor, Filter.SystemParameters>(); services.AddTransient <GenericSP.ParameterProvider>(); services.AddSingleton <GenericSP.MiddlewareRegistration>(); services.AddTransient <GenericSP.IGenericSPSerializer, GenericSP.GenericSPJsonSerializer>(); services.AddTransient <GenericSP.IGenericSPSerializer, GenericSP.GenericSPXmlSerializer>(); services.AddTransient <GenericSP.IGenericSPMiddleware, GenericSP.GenericSPMiddleware>(); services.AddTransient <Error.IResponseExceptionHandler, Error.SqlServerExceptionHandler>(); var opts = options ?? new GenericSP.SPMiddlewareOptions(); services.AddSingleton(opts); services.AddSingleton(swaggerFromSPOptions ?? new SwaggerGeneration.SwaggerFromSPOptions()); }