|
|
|
@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
|
using Microsoft.Extensions.Hosting; |
|
|
|
@ -83,15 +84,23 @@ namespace EPAServeur |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
services.AddDbContext<EpContext>(); |
|
|
|
|
using (var context = new EpContext()) |
|
|
|
|
services.AddDbContext<EpContext>(b => b.UseMySQL(Configuration["Data:DefaultConnection:ConnectionString"])); |
|
|
|
|
|
|
|
|
|
var optionBuider = new DbContextOptionsBuilder<EpContext>() |
|
|
|
|
.UseMySQL(Configuration["Data:DefaultConnection:ConnectionString"]) |
|
|
|
|
.Options; |
|
|
|
|
|
|
|
|
|
using (var context = new EpContext(optionBuider)) |
|
|
|
|
{ |
|
|
|
|
context.Database.EnsureDeleted(); //PENSEZ A ENLEVER CETTE LIGNE ET A NE JAMAIS LA REMETTRE QUAND LE SERVEUR SERA MIS EN PRODUCTION ^^ |
|
|
|
|
context.Database.EnsureCreated(); |
|
|
|
|
context.SaveChanges(); |
|
|
|
|
context.AjoutInformationsDeBase(); |
|
|
|
|
context.AjoutChamps(); |
|
|
|
|
context.AjouterNotes(); |
|
|
|
|
|
|
|
|
|
DataSeeder.AddInformationsDeBase(context); |
|
|
|
|
DataSeeder.AddChamps(context); |
|
|
|
|
DataSeeder.AddNotes(context); |
|
|
|
|
DataSeeder.AddEp(context); |
|
|
|
|
DataSeeder.AddEngagements(context); |
|
|
|
|
} |
|
|
|
|
//faire using, check si kekchoz exkist puis appeler les m<EFBFBD>thodes de cr<EFBFBD>ation si il n'y a rien |
|
|
|
|
|
|
|
|
|