first working version of zugferd rest service
This commit is contained in:
@@ -18,16 +18,29 @@ namespace ZUGFeRDRESTService
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
AppConfig = configuration.GetSection("Config");
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
private IConfigurationSection AppConfig { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
string oLogPath = AppConfig["LogPath"];
|
||||
bool.TryParse(AppConfig["LogDebug"], out bool oLogDebug);
|
||||
|
||||
services.AddControllers().AddNewtonsoftJson();
|
||||
services.AddRazorPages();
|
||||
services.AddTransient<IZugferdValidationDataService, ZugferdValidationDataService>();
|
||||
services.Configure<Config>(Configuration.GetSection("Config"));
|
||||
services.AddSingleton<ILogging>(sp => new Logging(oLogPath, oLogDebug));
|
||||
services.AddSingleton((Func<IServiceProvider, IDatabase>)(sp => {
|
||||
var logging = sp.GetService<ILogging>();
|
||||
var config = sp.GetService<IConfiguration>();
|
||||
|
||||
return new Database(logging, config);
|
||||
}));
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
||||
Reference in New Issue
Block a user