public void Apply(IPropertyInstance instance) { if (typeof(SiteEntity).IsAssignableFrom(instance.EntityType)) { if (instance.Property.PropertyType == typeof(DateTime)) { instance.CustomType <DateTimeData>(); } else if (instance.Property.PropertyType == typeof(DateTime?)) { instance.CustomType <NullableDateTimeData>(); } } else if (typeof(SystemEntity).IsAssignableFrom(instance.EntityType)) { if (instance.Property.PropertyType == typeof(DateTime)) { instance.CustomType <LocalDateTimeData>(); } else if (instance.Property.PropertyType == typeof(DateTime?)) { instance.CustomType <LocalNullableDateTimeData>(); } } }
public void Apply(IPropertyInstance instance) { if (instance.Type.IsEnum == false) return; if (EnumType == EnumType.Integer) instance.CustomType<int>(); else instance.CustomType<string>(); }
public void Apply(IPropertyInstance instance) { var attr = instance.Property.MemberInfo.GetCustomAttribute <EnumStringAttribute>(); if (attr == null) { instance.CustomType(instance.Property.PropertyType); } else { var customType = typeof(EnumStringType <>).MakeGenericType(instance.Property.PropertyType); instance.CustomType(customType); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType.Equals(typeof(IGeometry))) { instance.CustomType <SqLiteGeometryType>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(string)) { instance.CustomType("AnsiString"); } }
/// <inheritdoc/> public void Apply(IPropertyInstance instance) { if (instance.Type.Name == "DateTime" && instance.Property.Name.ToLower().Contains("utc")) { instance.CustomType <UtcDateTimeType>(); } }
public void Apply(IPropertyInstance instance) { if (typeof(Uri).IsAssignableFrom(instance.Property.PropertyType)) { instance.CustomType <UriType>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Type == typeof(TheSpecialEnum)) { instance.CustomType <SpecialEnumUserType>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(TimeSpan)) { instance.CustomType("TimeAsTimeSpan"); } }
public void Apply(IPropertyInstance instance) { if (new[] { typeof(DateTimeOffset), typeof(DateTimeOffset?) }.Contains(instance.Property.PropertyType)) { instance.CustomType("timestamptz"); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType.Equals(typeof(IGeometry))) { instance.CustomType(typeof(MsSqlGeometryHandler)); } }
public void Apply(IPropertyInstance instance) { if (new[] { typeof(DateTime), typeof(DateTime?) }.Contains(instance.Property.PropertyType)) { instance.CustomType("UtcDateTime"); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType.Equals(typeof(IGeometry))) { instance.CustomType<SqLiteGeometryType>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Type.Name == "Date") { instance.CustomType <UtcDateTimeType>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Type == typeof(Type)) { instance.CustomType <VersionAgnosticType>(); } }
public override void Apply(IPropertyInstance instance) { // Have to set CustomType to be able to read/write rows using NHibernate instance.CustomType <PostGisGeometryType>(); // Have to set CustomSqlType to generate correct SQL schema instance.CustomSqlType("geometry(Polygon)"); }
public void Apply(IPropertyInstance instance) { if (instance.Type.IsEnum) { instance.CustomType <SpecialEnumUserType>(); } }
public void Apply(IPropertyInstance instance) { if (new[] { typeof(TimeSpan), typeof(TimeSpan?) }.Contains(instance.Property.PropertyType)) { instance.CustomType("TimeAsTimeSpan"); } /* * if(new []{typeof(DateTime), typeof(DateTime?)}.Contains(instance.Property.PropertyType)) * instance.CustomType("datetime2"); */ if (new[] { typeof(DateTimeOffset), typeof(DateTimeOffset?) }.Contains(instance.Property.PropertyType)) { instance.CustomType("datetimeoffset"); } }
public void Apply(IPropertyInstance instance) { if (typeof(IGeometry).IsAssignableFrom(instance.Property.PropertyType)) { instance.CustomType(typeof(GeographyType)); instance.CustomSqlType("GEOGRAPHY"); } }
/// <inheritdoc/> public void Apply(IPropertyInstance instance) { if (instance.Property.Name.ToLower() == "createdatutc" || instance.Property.Name.ToLower() == "updatedatutc") { instance.CustomType <UtcDateTimeType>(); instance.Generated.Always(); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType.Equals(typeof(IGeometry))) { instance.CustomType<GeometryType>(); instance.CustomSqlType("Geography"); } }
public void Apply(IPropertyInstance instance) { var propertyType = instance.Type.GetUnderlyingSystemType(); var customType = typeof(NHStrongTypeIdUserType <>).MakeGenericType(propertyType); instance.CustomType(customType); }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType.Equals(typeof(IGeometry))) { instance.CustomType <GeometryType>(); instance.CustomSqlType("Geography"); } }
public void Apply(IPropertyInstance instance) { if (typeof(IGeometry).IsAssignableFrom(instance.Property.PropertyType)) { instance.CustomType(typeof(GeographyType)); instance.CustomSqlType("GEOGRAPHY"); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(NpgsqlRange <LocalDate>)) { instance.CustomType <RangeDateType>(); instance.CustomSqlType("daterange"); } }
/// <summary> /// The convention that is applied to a <see cref = "IPropertyInstance" /> when the criteria from the Accept method is meet. /// </summary> /// <param name="instance">An <see cref = "IPropertyInstance" /> to apply the convention to.</param> public void Apply(IPropertyInstance instance) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.CustomType<DateTimeOffsetSplitType>(); }
public void Apply(IPropertyInstance instance) { var type = instance.Property.PropertyType; if (type == typeof(XElement)) { instance.CustomType <XElementUserType>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(LocalTime) || instance.Property.PropertyType == typeof(LocalTime?)) { instance.CustomType <LocalTimeType>(); } else if (instance.Property.PropertyType == typeof(LocalDate) || instance.Property.PropertyType == typeof(LocalDate?)) { instance.CustomType <LocalDateType>(); } else if (instance.Property.PropertyType == typeof(Instant) || instance.Property.PropertyType == typeof(Instant?)) { instance.CustomType <InstantType>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.ToString().Contains("String")) { instance.CustomType("StringClob"); instance.CustomSqlType("NTEXT"); //instance.Length(4001); } }
public void Apply(IPropertyInstance instance) { if (typeof(SiteEntity).IsAssignableFrom(instance.EntityType)) { if (instance.Property.PropertyType == typeof(DateTime)) instance.CustomType<DateTimeData>(); else if (instance.Property.PropertyType == typeof(DateTime?)) instance.CustomType<NullableDateTimeData>(); } else if (typeof(SystemEntity).IsAssignableFrom(instance.EntityType)) { if (instance.Property.PropertyType == typeof(DateTime)) instance.CustomType<LocalDateTimeData>(); else if (instance.Property.PropertyType == typeof(DateTime?)) instance.CustomType<LocalNullableDateTimeData>(); } }
public void Apply(IPropertyInstance instance) { if (instance.Type.Name == "Date") { //or //if (instance.Type.GetUnderlyingSystemType() == typeof(Date)) instance.CustomType <DateTranslator>(); } }
/// <summary> /// Applies the specified instance. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IPropertyInstance instance) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.CustomType(instance.Property.PropertyType); }
public void Apply(IPropertyInstance instance) { instance.CustomType <BinaryBlobType>(); instance.Nullable(); // Length is set because the NHibernate BinaryBlobType only specifies the SQL type as "binary", defaulting to a max length of 8000 instance.Length(int.MaxValue); lazyLoadIfSpecified(instance); }
public void Apply(IPropertyInstance instance) { var type = instance.Property.PropertyType; if (type == typeof(DateTime) || type == typeof(DateTime?)) { instance.CustomType("timestamp"); instance.CustomSqlType("datetime2"); } }
public void Apply(IPropertyInstance instance) { if (!instance.Property.PropertyType.IsSubclassOf(typeof(Geometry))) { return; } instance.CustomType <Wgs84GeometryType>(); instance.CustomSqlType("geometry"); }
public void Apply(IPropertyInstance instance) { var propertyType = instance.Type.GetUnderlyingSystemType(); var identityUserType = this.GetUserType(propertyType); if (identityUserType == null) { return; } instance.CustomType(identityUserType); }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(byte[])) { instance.CustomType("BinaryBlob"); instance.Length(1048576); } else { instance.CustomType(instance.Property.PropertyType); if (instance.Property.PropertyType.IsEnum) { instance.Not.Nullable(); } if (instance.Property.Name.Equals("Deleted")) { instance.Not.Nullable(); } } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(string)) { instance.CustomType("AnsiString"); instance.Length(500); } else if (instance.Property.PropertyType == typeof(decimal)) { instance.Precision(18); instance.Scale(2); } }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType != typeof(string)) return; var memberInfo = instance.Property.MemberInfo; var stringLengthAttribute = memberInfo.GetCustomAttribute<StringLengthAttribute>(); var isDbLengthAttribute = memberInfo.GetCustomAttribute<IsDBLengthAttribute>(); if (stringLengthAttribute != null && isDbLengthAttribute != null) { instance.Length(stringLengthAttribute.MaximumLength); } else { instance.CustomType<VarcharMax>(); instance.Length(4001); } }
public void Apply(IPropertyInstance instance) { instance.CustomType<int>(); instance.Not.Nullable(); }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(string)) instance.CustomType("AnsiString"); }
public void Apply(IPropertyInstance instance) { if (instance.Type.IsEnum) instance.CustomType<int>(); }
public void Apply(IPropertyInstance instance) { instance.CustomType<UtcDateTimeType>(); }
public void Apply(IPropertyInstance instance) { instance.CustomType<UserType>(); }
public void Apply(IPropertyInstance instance) { instance.CustomType("Ticks"); }
public void Apply(IPropertyInstance instance) { instance.CustomType(instance.Property.PropertyType); instance.Not.Nullable(); }
public void Apply(IPropertyInstance instance) { if (instance.Property.PropertyType == typeof(TimeSpan)) instance.CustomType("TimeAsTimeSpan"); }
public void Apply(IPropertyInstance instance) { var closedType = openType.MakeGenericType(instance.Property.PropertyType); instance.CustomType(closedType); }
public void Apply(IPropertyInstance instance) { instance.Length(Enum.GetNames(instance.Property.PropertyType).Max(name => name.Length)); instance.CustomType(typeof(string)); }
public void Apply(IPropertyInstance instance) { instance.CustomType(typeof(EnumerableOfStringType)); }
public void Apply(IPropertyInstance instance) { instance.CustomType<TimestampType>(); }
public void Apply(IPropertyInstance instance) { instance.CustomType<CultureInfoType>(); }
public void Apply(IPropertyInstance target) { target.CustomType(target.Property.PropertyType); }
public void Apply(IPropertyInstance instance) { instance.CustomType(instance.Property.PropertyType); // Enumerations can't be null instance.Not.Nullable(); }
public void Apply(IPropertyInstance instance) { instance.CustomType(instance.Property.PropertyType); }
public void Apply(IPropertyInstance instance) { instance.CustomType(typeof(NullableTimeType)); }
public void Apply(IPropertyInstance instance) { instance.CustomType(typeof(ByteType)); }
public void Apply(IPropertyInstance instance) { instance.CustomType(instance.Property.PropertyType); Debug.WriteLine("-----IUserTypeConvention----"+instance.EntityType+" " + instance.Property.PropertyType); }