Пример #1
0
        public ColumnMember(PropertyInfo pi)
            : base(pi)
        {
            this.ColumnAttribute = ModelReflection.ColumnAttribute(pi);
            if (ColumnAttribute != null)
            {
                this.IsPrimaryKey   = ColumnAttribute.IsPrimaryKey;
                this.IsAutoIdentity = ColumnAttribute.IsAutoIdentity;
                this.IsForReadOnly  = ColumnAttribute.IsForReadOnly;

                this.Name = ColumnAttribute.Name ?? pi.Name;
                this.Skip = ColumnAttribute.IsForReadOnly;
            }
        }
Пример #2
0
        public static String ColumnName(PropertyInfo pi)
        {
            var ca = ModelReflection.ColumnAttribute(pi);

            if (ca == null) //it's not a column!
            {
                return(null);
            }

            if (!String.IsNullOrEmpty(ca.Name))
            {
                return(ca.Name);
            }
            else
            {
                return(pi.Name);
            }
        }