first working version of zugferd rest service

This commit is contained in:
Jonathan Jenne
2020-03-20 13:48:09 +01:00
parent 3d3a491744
commit 7b3dc1bf89
16 changed files with 336 additions and 111 deletions

View File

@@ -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.