//public MetaColumnInfo() { }

        //public MetaColumnInfo(Microsoft.AspNet.Scaffolding.Core.Metadata.PropertyMetadata property)
        //    : this(property.PropertyName, property.PropertyName, property.ShortTypeName, (property.RelatedModel != null))
        //{
        //}

        //public MetaColumnInfo(CodeParameter property)
        //    : this(property.Name, property.DocComment, property.Type.AsString, false)
        //{
        //}

        //public MetaColumnInfo(CodeProperty property)
        //    : this(property.Name, property.DocComment, property.Type.AsString, false)
        //{
        //}

        //private MetaColumnInfo(string strName, string strDisplayName, string strType, bool relatedModel)
        //{
        //    this.Name = strName;
        //    this.ShortTypeName = strType;
        //    this.strDataType = strType.Replace("?", "").Replace("System.", "").ToLower();

        //    if (!relatedModel)
        //    {
        //        this.DataType = GetColumnType(this.strDataType);
        //        IsVisible = true;
        //    }
        //    else
        //    {
        //        this.DataType = euColumnType.RelatedModel;
        //        IsVisible = false;  //不勾选导航属性
        //    }

        //    DisplayName = strDisplayName ?? this.Name;
        //    Nullable = true;
        //}


        public MetaColumnInfo(CodeProperty property)
        {
            string strName        = property.Name;
            string strType        = property.Type.AsString;
            string strDisplayName = VmUtils.getCName(property);

            this.Name          = property.Name;
            this.ShortTypeName = property.Type.AsString;
            //this.strDataType = strType.Replace("?", "").Replace("System.", "").ToLower();
            //this.strDataType = strType.Replace("System.", "");
            this.strDataType = strType.Split('.').Last();
            this.DataType    = GetColumnType(strType);
            DisplayName      = strDisplayName ?? this.Name;
            Nullable         = true;
            Required         = false;
            setPropWithAttributes(property);
            if (strDataType.ToLower() == "int" || strDataType.ToLower() == "guid")
            {
                Nullable = false;
            }
            this.ControlType = GetControlType();  //放在setPropWithAttributes之后

            IsDtoVisible  = IsDtoVisibleMember();
            IsItemVisible = IsItemVisibleMember();
        }
        public ModelType(CodeType codeType)
        {
            if (codeType == null)
            {
                throw new ArgumentNullException("codeType");
            }

            CodeType    = codeType;
            TypeName    = codeType.FullName;
            DisplayName = (codeType.Namespace != null && !String.IsNullOrWhiteSpace(codeType.Namespace.FullName))
                              ? String.Format("{0} ({1})", codeType.Name, codeType.Namespace.FullName)
                              : codeType.Name;
            ShortName = codeType.Name;
            CName     = VmUtils.getCName(codeType);
        }