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