asp.net core实体类生产CRUD后台管理界面

  using FreeSql;

  using ojbk.Entities;

  var fsql = new FreeSql.FreeSqlBuilder()

  .UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=test.db;Pooling=true;Max Pool Size=10")

  .UseAutoSyncStructure(true)

  .UseNoneCommandParameter(true)

  .UseMonitorCommand(cmd => Console.WriteLine(cmd.CommandText + "

  "))

  .Build();

  var builder = WebApplication.CreateBuilder(args);

  builder.Services.AddControllersWithViews();

  builder.Services.AddSingleton(fsql);

  builder.Services.AddEndpointsApiExplorer();

  builder.Services.AddSwaggerGen();

  var app = builder.Build();

  if (app.Environment.IsDevelopment())

  {

  app.UseSwagger();

  app.UseSwaggerUI();

  }

  app.UseAuthorization();

  app.MapControllers();

  app.UseDefaultFiles();

  app.UseStaticFiles();

  /******************************* 以下是核心代码 **************************/

  app.UseFreeAdminLtePreview("/",

  typeof(Config),

  typeof(Role),

  typeof(Menu),

  typeof(User),

  typeof(Department),

  typeof(Employee),

  typeof(Position),

  typeof(AppLog),

  typeof(LoginLog),

  typeof(OprationLog),

  typeof(IdleScheduler.TaskInfo),

  typeof(IdleScheduler.TaskLog)

  );

  app.Run();