示例#1
0
        private void Init()
        {
            TargetColumnAttribute attribute = this.MpropertyInfo.GetCustomAttribute <SqlDataBaseService.colunm.TargetColumnAttribute>();

            if (attribute == null)
            {
                this._colunmName = this._mpropertyInfo.Name;
                this._isPk       = false;
                this.IsFK        = false;
                this.IsHasNull   = true;
                this.Column_type = "varchar";
                this.DataLength  = -1;
            }


            if (string.IsNullOrWhiteSpace(attribute.Name))
            {
                this._colunmName = this._mpropertyInfo.Name;
            }
            else
            {
                this._colunmName = attribute.Name;
            }
            if (string.IsNullOrWhiteSpace(attribute.ColumnType))
            {
                this.Column_type = attribute.ColumnType;
            }
            this.Column_type = "varchar";

            if (attribute.DataLength < 1)
            {
                this.DataLength = attribute.DataLength;
            }
            else
            {
                this.DataLength = -1;
            }

            if (attribute.Default_Value == null)
            {
                this.Default_value = attribute.Default_Value;
            }
            this.Default_value = null;
            this._isPk         = attribute.Is_PK;
            this.IsFK          = attribute.IsFK;
            this.IsHasNull     = attribute.IsHasNull;
        }
示例#2
0
        private ClassFiledInfo(PropertyInfo info, object _colunmValue = null)
        {
            this._colunmName      = null;
            this._colunmValue     = null;
            this._isPk            = false;
            this._customAttribute = null;
            this._mpropertyInfo   = null;
            this._isFK            = false;
            this._isHasNull       = true;
            this._column_type     = "";
            this._dataLength      = -1;
            this._default_value   = null;

            this.MpropertyInfo = info;
            this._colunmValue  = _colunmValue;
            this.Init();
        }
        private void Init()
        {
            TargetColumnAttribute attribute = this.MpropertyInfo.GetCustomAttribute <TargetColumnAttribute>();

            if (attribute == null)
            {
                this._colunmName = this._mpropertyInfo.Name;
                this.IsPk        = false;
                this.IsFK        = false;
                this.IsHasNull   = true;
                this.Column_type = "varchar";
                this.DataLength  = -1;
                return;
            }

            ColunmName = this.MpropertyInfo.Name;
            if (!string.IsNullOrWhiteSpace(attribute.Name))
            {
                ColunmName = attribute.Name;
            }
            Column_type = ColumnConfigCantas.DEFAULT_COLUMN_TYPE;
            if (!string.IsNullOrWhiteSpace(attribute.ColumnType))
            {
                Column_type = attribute.ColumnType;
            }

            DataLength = -1;
            if (attribute.DataLength > 0)
            {
                DataLength = attribute.DataLength;
            }
            Default_value = null;
            if (attribute.Default_Value != null)
            {
                this.Default_value = attribute.Default_Value;
            }
            this.IsPk      = attribute.Is_PK;
            this.IsFK      = attribute.IsFK;
            this.IsHasNull = attribute.IsHasNull;
        }