DbConnectionOptions.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. namespace Admin.NET.Core;
  2. /// <summary>
  3. /// 数据库配置选项
  4. /// </summary>
  5. public sealed class DbConnectionOptions : IConfigurableOptions<DbConnectionOptions>
  6. {
  7. /// <summary>
  8. /// 数据库集合
  9. /// </summary>
  10. public List<DbConnectionConfig> ConnectionConfigs { get; set; }
  11. public void PostConfigure(DbConnectionOptions options, IConfiguration configuration)
  12. {
  13. foreach (var dbConfig in options.ConnectionConfigs)
  14. {
  15. if (string.IsNullOrWhiteSpace(dbConfig.ConfigId))
  16. dbConfig.ConfigId = SqlSugarConst.ConfigId;
  17. }
  18. }
  19. }
  20. public sealed class DbConnectionConfig : ConnectionConfig
  21. {
  22. /// <summary>
  23. /// 启用库表初始化
  24. /// </summary>
  25. public bool EnableInitDb { get; set; }
  26. /// <summary>
  27. /// 启用种子初始化
  28. /// </summary>
  29. public bool EnableInitSeed { get; set; }
  30. /// <summary>
  31. /// 启用库表差异日志
  32. /// </summary>
  33. public bool EnableDiffLog { get; set; }
  34. /// <summary>
  35. /// 启用驼峰转下划线
  36. /// </summary>
  37. public bool EnableUnderLine { get; set; }
  38. }