Пример #1
0
 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>();
         }
     }
 }
Пример #2
0
        public void Apply(IPropertyInstance instance)
        {
            if (instance.Type.IsEnum == false)
                return;

            if (EnumType == EnumType.Integer)
                instance.CustomType<int>();
            else
                instance.CustomType<string>();
        }
Пример #3
0
        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>();
     }
 }
Пример #5
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.PropertyType == typeof(string))
     {
         instance.CustomType("AnsiString");
     }
 }
Пример #6
0
 /// <inheritdoc/>
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Type.Name == "DateTime" && instance.Property.Name.ToLower().Contains("utc"))
     {
         instance.CustomType <UtcDateTimeType>();
     }
 }
Пример #7
0
 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");
     }
 }
Пример #11
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.PropertyType.Equals(typeof(IGeometry)))
     {
         instance.CustomType(typeof(MsSqlGeometryHandler));
     }
 }
Пример #12
0
 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>();
     }
 }
Пример #14
0
 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)");
 }
Пример #17
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Type.IsEnum)
     {
         instance.CustomType <SpecialEnumUserType>();
     }
 }
Пример #18
0
        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");
            }
        }
Пример #19
0
 public void Apply(IPropertyInstance instance)
 {
     if (typeof(IGeometry).IsAssignableFrom(instance.Property.PropertyType))
     {
         instance.CustomType(typeof(GeographyType));
         instance.CustomSqlType("GEOGRAPHY");
     }
 }
Пример #20
0
 /// <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");
     }
 }
Пример #22
0
        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");
     }
 }
Пример #25
0
 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>();
        }
Пример #27
0
        public void Apply(IPropertyInstance instance)
        {
            var type = instance.Property.PropertyType;

            if (type == typeof(XElement))
            {
                instance.CustomType <XElementUserType>();
            }
        }
Пример #28
0
 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>();
     }
 }
Пример #29
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.ToString().Contains("String"))
     {
         instance.CustomType("StringClob");
         instance.CustomSqlType("NTEXT");
         //instance.Length(4001);
     }
 }
Пример #30
0
        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>();

            }
        }
Пример #31
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Type.Name == "Date")
     {
         //or
         //if (instance.Type.GetUnderlyingSystemType() == typeof(Date))
         instance.CustomType <DateTranslator>();
     }
 }
Пример #32
0
        /// <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);
        }
Пример #34
0
        public void Apply(IPropertyInstance instance)
        {
            var type = instance.Property.PropertyType;

            if (type == typeof(DateTime) || type == typeof(DateTime?))
            {
                instance.CustomType("timestamp");
                instance.CustomSqlType("datetime2");
            }
        }
Пример #35
0
        public void Apply(IPropertyInstance instance)
        {
            if (!instance.Property.PropertyType.IsSubclassOf(typeof(Geometry)))
            {
                return;
            }

            instance.CustomType <Wgs84GeometryType>();
            instance.CustomSqlType("geometry");
        }
Пример #36
0
        public void Apply(IPropertyInstance instance)
        {
            var propertyType     = instance.Type.GetUnderlyingSystemType();
            var identityUserType = this.GetUserType(propertyType);

            if (identityUserType == null)
            {
                return;
            }

            instance.CustomType(identityUserType);
        }
Пример #37
0
        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();
                }
            }
        }
Пример #38
0
 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);
     }
 }
Пример #39
0
 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();
 }
Пример #41
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.PropertyType == typeof(string))
         instance.CustomType("AnsiString");
 }
Пример #42
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Type.IsEnum)
         instance.CustomType<int>();
 }
 public void Apply(IPropertyInstance instance) {
     instance.CustomType<UtcDateTimeType>();
 }
Пример #44
0
 public void Apply(IPropertyInstance instance)
 {
     instance.CustomType<UserType>();
 }
 public void Apply(IPropertyInstance instance)
 {
     instance.CustomType("Ticks");
 }
Пример #46
0
 public void Apply(IPropertyInstance instance)
 {
     instance.CustomType(instance.Property.PropertyType);
     instance.Not.Nullable();
 }
Пример #47
0
 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);
        }
Пример #49
0
 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));
		}
Пример #51
0
 public void Apply(IPropertyInstance instance)
 {
     instance.CustomType<TimestampType>();
 }
 public void Apply(IPropertyInstance instance)
 {
     instance.CustomType<CultureInfoType>();
 }
Пример #53
0
 public void Apply(IPropertyInstance target)
 {
     target.CustomType(target.Property.PropertyType);
 }
Пример #54
0
		public void Apply(IPropertyInstance instance)
		{
			instance.CustomType(instance.Property.PropertyType);
			// Enumerations can't be null
			instance.Not.Nullable();
		}
Пример #55
0
 public void Apply(IPropertyInstance instance)
 {
     instance.CustomType(instance.Property.PropertyType);
 }
Пример #56
0
		public void Apply(IPropertyInstance instance)
		{
			instance.CustomType(typeof(NullableTimeType));
		}
Пример #57
0
		public void Apply(IPropertyInstance instance)
		{
			instance.CustomType(typeof(ByteType));
		}
Пример #58
0
 public void Apply(IPropertyInstance instance)
 {
     instance.CustomType(instance.Property.PropertyType);
     Debug.WriteLine("-----IUserTypeConvention----"+instance.EntityType+" " + instance.Property.PropertyType);
 }