using cylsg.utility;
|
using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace cylsg.Core
|
{
|
public class DbCoreUntil
|
{
|
/// 获取需要更新或者是创建的 数据库表模型List
|
/// </summary>
|
/// <typeparam name="T">继承表某个表的所有</typeparam>
|
/// <param name="ModeProjectName"></param>
|
/// <param name="ModeNamespace"></param>
|
/// <param name="ConfigId"></param>
|
/// <returns></returns>
|
public static Type[] DbCodeFirstModes(string ModeProjectName, string ModeNamespace = null, string ConfigId = null, Type subClass = null, Type thisAttribute = null)
|
{
|
|
|
#nullable enable
|
Type[]? types = CommonHelper.GetAllAssembly().Where(x => x.FullName.Contains(ModeProjectName + ",")).FirstOrDefault()?.GetTypes().WhereIF(!string.IsNullOrEmpty(ModeNamespace), name => name.FullName.Contains(ModeNamespace + ".")).ToArray()
|
.WhereIF(subClass != null, x => x.IsSubclassOf(subClass)).ToArray()
|
.WhereIF(thisAttribute != null, x => x.GetCustomAttributes(thisAttribute, true).Length > 0).ToArray();
|
|
|
return types;
|
|
}
|
}
|
}
|