@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 要生成的表名数组
|
||||
|
||||
Reference in New Issue
Block a user