diff --git a/src/StaffManagement/Database/DbInit.cs b/src/StaffManagement/Database/DbInit.cs
deleted file mode 100644
index 77c9a92..0000000
--- a/src/StaffManagement/Database/DbInit.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace StaffManagement.Database
-{
- static public class DbInit
- {
- ///
- /// 初始化数据库
- ///
- ///
- ///
- public static IApplicationBuilder SMDbInit(this IApplicationBuilder app) {
- app.ApplicationServices.GetService().Init();
- return app;
- }
- ///
- /// 初始化数据库
- ///
- /// 数据库上下文
- ///
- public static SMDbContext Init(this SMDbContext db) {
- db.Database.EnsureCreated();
- return db;
- }
- }
-}
diff --git a/src/StaffManagement/Startup.cs b/src/StaffManagement/Startup.cs
index 1829bed..f8ff34a 100644
--- a/src/StaffManagement/Startup.cs
+++ b/src/StaffManagement/Startup.cs
@@ -66,7 +66,7 @@ namespace StaffManagement
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
- db.Init();
+ db.Database.EnsureCreated();
app.UseSwagger();
app.UseSwaggerUI(c => {
c.SwaggerEndpoint("/swagger/V1/swagger.json","ӿĵ");