コード例 #1
0
 public PostgreSqlColumnAttribute(string name = null, string dataType = null, bool primaryKey = false, object defaultValue = null, PostgreSqlIndexType indexing = PostgreSqlIndexType.None)
 {
     Indexing     = indexing;
     Name         = name;
     DataType     = dataType;
     PrimaryKey   = primaryKey;
     DefaultValue = defaultValue;
 }
コード例 #2
0
        public PostgreSqlColumnSchema(PostgreSqlColumnAttribute inner, PropertyInfo propertyInfo)
        {
            this.propertyInfo = propertyInfo;
            var underlyingType = System.Nullable.GetUnderlyingType(propertyInfo.PropertyType);
            var type           = underlyingType ?? propertyInfo.PropertyType;

            PrimaryKey = inner.PrimaryKey;
            Name       = inner.Name ?? propertyInfo.Name;
            DataType   = inner.DataType
                         ?? (type == typeof(DateTimeOffset) ? "varchar(39)" : SqlUtil.GetSqlTypeFromType(type));
            Nullable = underlyingType != null || type.GetTypeInfo().IsClass;
            Indexing = inner.Indexing;
            // TODO: Implement column indexing

            this.parseFunc = getParseFuncByType(type, underlyingType != null);
        }