diff --git a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj index fc8d2d1ec..b00d3c836 100644 --- a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj +++ b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj @@ -82,7 +82,9 @@ + + diff --git a/IRaCIS.Core.Test/Program.cs b/IRaCIS.Core.Test/Program.cs index 5c692dbac..0481b1089 100644 --- a/IRaCIS.Core.Test/Program.cs +++ b/IRaCIS.Core.Test/Program.cs @@ -1,5 +1,8 @@  using Fluid; +using IRaCIS.Core.Test.Template; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.IO; @@ -42,6 +45,25 @@ partial class Program Directory.CreateDirectory(dtoPath); } #endregion + using (var context = new YourDbContext()) + { + var model = context.Model; + + foreach (var entityType in model.GetEntityTypes()) + { + string tableName = entityType.GetTableName(); + Console.WriteLine($"Table: {tableName}"); + + foreach (var property in entityType.GetProperties()) + { + string columnName = property.GetColumnName(); + string dataType = property.ClrType.Name; + bool isNullable = property.IsNullable; + + Console.WriteLine($" Column: {columnName}, Data Type: {dataType}, Is Nullable: {isNullable}"); + } + } + } // 要生成的表名数组 diff --git a/IRaCIS.Core.Test/Template/YourDbContext.cs b/IRaCIS.Core.Test/Template/YourDbContext.cs new file mode 100644 index 000000000..09593fc25 --- /dev/null +++ b/IRaCIS.Core.Test/Template/YourDbContext.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Test.Template +{ + class YourDbContext : DbContext + { + + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseSqlServer("Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true"); + } + + } +}