예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColumnMetadata"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="length">The length.</param>
        /// <param name="isNullable">if set to <c>true</c> [is nullable].</param>
        /// <param name="isKey">if set to <c>true</c> [is key].</param>
        /// <param name="isGenerated">if set to <c>true</c> [is generated].</param>
        internal ColumnMetadata(PropertyInfo property, string columnName, int length, bool isNullable, bool isKey, bool isGenerated)
        {
            Property       = property;
            StringLength   = length;
            ColumnName     = columnName;
            IsKeyColumn    = isKey;
            IsKeyGenerated = isKey && isGenerated;
            IsNullable     = isNullable;
            NativeType     = Nullable.GetUnderlyingType(property.PropertyType) ?? property.PropertyType;

            if (NativeType.IsEnum)
            {
                NativeType = NativeType.GetEnumUnderlyingType();
            }

            Proxy = CreatePropertyProxy(property);
        }