📅  最后修改于: 2022-03-11 14:49:00.107000             🧑  作者: Mango
public static class SeedDatabase
{
public static void Initialize(IServiceProvider serviceProvider)
{
using (var context = new HospitalManagementDbContext(serviceProvider.GetRequiredService>()))
{
if (context.InvestigationTags.Any())
{
return;
}
context.InvestigationTags.AddRange(
new Models.InvestigationTag
{
Abbreviation = "A1A",
Name = "Alpha-1 Antitrypsin"
},
new Models.InvestigationTag
{
Abbreviation = "A1c",
Name = "Hemoglobin A1c"
},
new Models.InvestigationTag
{
Abbreviation = "Alk Phos",
Name = "Alkaline Phosphatase"
}
);
context.SaveChanges();
}
}
}