Beispiel #1
0
        public EntityProperty(PropertyInfo property)
        {
            Property  = property.Name;
            IsNumeric = property.PropertyType.IsNumber();
            Getter    = GetterBuilder.Build(property);
            Setter    = SetterBuilder.Build(property.DeclaringType, property);
            Comparer  = ComparerBuilder.Build(property.DeclaringType, property);

            _isValueType    = property.PropertyType.IsValueType;
            _isNullableType = property.PropertyType.IsNullableValueType();

            IsSelectable = true;
            IsInsertable = true;
            IsUpdatable  = true;

            if (_isNullableType)
            {
                SetNullable();
            }
            else
            {
                DefaultValue = property.PropertyType.GetDefaultValue();
            }

            var autoDetectedKeyName = AutodetectableKeyNames.Any(n => n.Equals(property.Name, StringComparison.InvariantCultureIgnoreCase));

            if (autoDetectedKeyName)
            {
                SetKey();
            }
        }