using Admin.NET.Plugin.AiDOP.Entity; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SqlSugar; namespace Admin.NET.Plugin.AiDOP; /// /// AiDOP 插件启动配置(按需扩展 DI) /// [AppStartup(900)] public class Startup : AppStartup { public void ConfigureServices(IServiceCollection services) { } /// /// 开发环境下为 Demo 表执行 CodeFirst(表已存在则跳过变更,行为取决于 SqlSugar 配置)。 /// public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (!env.IsDevelopment()) return; using var scope = app.ApplicationServices.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); db.CodeFirst.InitTables(typeof(AdoOrder), typeof(AdoPlan), typeof(AdoWorkOrder)); } }