Commit inicial: ITCA_API_SAP_WMS (.NET Core 3.1)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
2b82744eb8
168 files changed
+11066
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
|
||||
namespace Net.Data
|
||||
{
|
||||
public class LocalData
|
||||
{
|
||||
public static string ConnectionString { get; private set; }
|
||||
|
||||
// Esquema HANA: por defecto la compañia del Service Layer (SapServiceLayer:company)
|
||||
public static string Schema { get; private set; }
|
||||
|
||||
// Unico punto de lectura de las credenciales HANA (seccion "Hana" de appsettings.json)
|
||||
public static void Configure(IConfiguration configuration)
|
||||
{
|
||||
var server = configuration["Hana:server"];
|
||||
var user = configuration["Hana:user"];
|
||||
var password = configuration["Hana:password"];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(server) || string.IsNullOrWhiteSpace(user) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new InvalidOperationException("Falta la seccion \"Hana\" (server, user, password) en appsettings.json");
|
||||
}
|
||||
|
||||
ConnectionString = $"Server={server};UserName={user};Password={password}";
|
||||
|
||||
var schema = configuration["Hana:schema"];
|
||||
if (string.IsNullOrWhiteSpace(schema)) schema = configuration["SapServiceLayer:company"];
|
||||
if (string.IsNullOrWhiteSpace(schema))
|
||||
{
|
||||
throw new InvalidOperationException("Falta el esquema HANA: configure Hana:schema o SapServiceLayer:company en appsettings.json");
|
||||
}
|
||||
|
||||
Schema = schema;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user