测试数据库上下文
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2024-09-05 00:04:41 +08:00
parent 706cb888c8
commit dd13eddfe3
3 changed files with 44 additions and 0 deletions
+22
View File
@@ -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}");
}
}
}
// 要生成的表名数组