// 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.AddDefaultPolicy( builder => builder.AllowAnyOrigin())); var postgreSQLConnectionConfiguration = new PostgreSQLConfiguration(Configuration.GetConnectionString("PostgreSQLConnection")); services.AddSingleton(postgreSQLConnectionConfiguration); services.AddScoped <IClient, ClientR>(); services.AddScoped <IDeviceType, DeviceTypeR>(); services.AddScoped <IDevice, DeviceR>(); services.AddScoped <IAdmin, AdminR>(); services.AddScoped <IOrder, OrderR>(); services.AddScoped <IDistributor, DistributorR>(); services.AddScoped <IInvoice, InvoiceR>(); services.AddScoped <IRoom, RoomR>(); services.AddScoped <IAppDevice, AppDeviceR>(); services.AddScoped <IControl, ControlR>(); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "PostgreSQLBackEnd", Version = "v1" }); }); }
private PostgreSQLConfiguration GetPostgresConfiguration(NhibernateSettings nhibernateSettings) { PostgreSQLConfiguration config = PostgreSQLConfiguration.PostgreSQL82 .ConnectionString(nhibernateSettings.ConnectionString) .DefaultSchema(nhibernateSettings.DBSchema); if (nhibernateSettings.ShowSQL) { config.ShowSql(); } return(config); }
private PostgreSQLConfiguration GetPostgresConfiguration() { PostgreSQLConfiguration config = PostgreSQLConfiguration.PostgreSQL82 .ConnectionString(_connectionString) .DefaultSchema(_nhibernateSchema); if (_showSql) { config.ShowSql(); } return(config); }
private static IPersistenceConfigurer PostgreSql82ConfigureDatabase(NHConfigurationSection nhConfiguration) { PostgreSQLConfiguration cfg = PostgreSQLConfiguration.PostgreSQL82 .ConnectionString(c => c.FromConnectionStringWithKey(nhConfiguration.ConnectionStringName)) .UseOuterJoin() .DefaultSchema(nhConfiguration.DatabaseSchema); #if DEBUG cfg.ShowSql(); #endif return(cfg); }
public async Task CreatePostgreSqlConfiguration(CreatePostgreSQLConfigModel configModel) { var config = new PostgreSQLConfiguration { ConfigId = configModel.ConfigId, ConnectionLifetime = configModel.ConnectionLifetime, Database = configModel.Database, Host = configModel.Host, MaxPoolSize = configModel.MaxPoolSize, MinPoolSize = configModel.MinPoolSize, Pooling = configModel.Pooling, Port = configModel.Port, ProtectedPassword = configModel.ProtectedPassword, UserId = configModel.UserId }; await _ctx.PostgreSqlconfigurations.AddRangeAsync(config); await _ctx.SaveChangesAsync(CancellationToken.None); }
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">string para conectar como db</param> public OrderR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">string para conectar como db</param> public AppDeviceR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">string para conectar como db</param> public InvoiceR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">string para conectar como db</param> public DistributorR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">string para conectar como db</param> public RoomR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;
/// <summary> /// Constructor de clase /// </summary> /// <param name="connectionString">string para conectar a postgresql</param> public AdminR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">string para conectar como db</param> public ControlR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">string para conectar como db</param> public ClientR(PostgreSQLConfiguration connectionString) => _connectionString = connectionString;