1
yhj
2024-07-24 5e5d945e91568b973faa27d8ab0bcef99fc4a6c5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace CSFrameworkV5.Core.CodeGenerator
{
    public sealed class ORM_Tools
    {
        /// <summary>
        /// 根据ORM获取特性内定义的表名
        /// </summary>
        /// <param name="ORM">ORM类的类型,如:tb_Customer,使用typeof(tb_Customer)获取</param>
        /// <returns></returns>
        public static string GetTableName(Type ORM)
        {
            var ta = ORM.GetCustomAttributes(typeof(ORM_TableAttribute), false);
            if (ta.Length > 0)
                return (ta[0] as ORM_TableAttribute).TableName;
            else
                return "";
        }
    }
}