移动系统liao
2025-05-01 a247547df86f0fad8f03aebb91de68d3f2bc7918
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
 
        }
    }
}