Student/Common/Attributes/TableFieldAttribute.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assets.Common.Attributes
{
    /// <summary>
    /// 一个自定义特性:实体类属性与数据库表字段关联
    /// </summary>
    [System.AttributeUsage(System.AttributeTargets.Field |
                            System.AttributeTargets.Property
                            ,AllowMultiple = false)  // Multiuse attribute.  
    ]
    class TableFieldAttribute : Attribute
    {
        private string fieldName;
        private string fieldType;
        private bool primaryKey;


        public TableFieldAttribute(string fieldName, string fieldType)
        {
            this.FieldName = fieldName;
            this.FieldType = fieldType;
            this.primaryKey = false;
        }

        public TableFieldAttribute(string fieldName, string fieldType, bool primaryKey)
        {
            this.FieldName = fieldName;
            this.FieldType = fieldType;
            this.PrimaryKey = primaryKey;
        }

        public string FieldName
        {
            get
            {
                return fieldName;
            }

            set
            {
                fieldName = value;
            }
        }

        public string FieldType
        {
            get
            {
                return fieldType;
            }

            set
            {
                fieldType = value;
            }
后面还有 16 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。