///<sumary> /// The Constructor ///<sumary> ///<param name="logger"></param> ///<param name="serviceScopeFactory"></param> public ContratosImpl(ILogger <ContratosImpl> logger, IServiceScopeFactory serviceScopeFactory) { _logger = logger; _logger.LogDebug("Building th ContratosImpl .."); _serviceScopeFactory = serviceScopeFactory; //Create the database _logger.LogInformation("Creating the Database .."); using (var scope = _serviceScopeFactory.CreateScope()) { FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); fc.Database.EnsureCreated(); fc.SaveChanges(); } _logger.LogDebug("Done."); }