Exemplo n.º 1
0
        protected override void OnInitialized()
        {
            base.OnInitialized();

            if (!Sortable)
            {
                Sortable = SorterMultiple != default || SorterCompare != default || Sort != default;
            }

            if (IsHeader)
            {
                if (FieldExpression != null)
                {
                    _propertyReflector = PropertyReflector.Create(FieldExpression);
                    if (Sortable)
                    {
                        SortModel = new SortModel <TData>(_propertyReflector.Value.PropertyInfo, SorterMultiple, Sort, SorterCompare);
                    }
                }
                else
                {
                    (GetValue, SortModel) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this);
                }
            }
            else if (IsBody)
            {
                SortModel     = Context.HeaderColumns[ColIndex] is IFieldColumn fieldColumn ? fieldColumn.SortModel : null;
                (GetValue, _) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this);
            }

            ClassMapper
            .If("ant-table-column-has-sorters", () => Sortable)
            .If($"ant-table-column-sort", () => Sortable && SortModel != null && SortModel.SortType.IsIn(SortType.Ascending, SortType.Descending));
        }
Exemplo n.º 2
0
        public void GetMetadata_ForSealedBusinessObject_WithExistingMixin()
        {
            var mixinTargetType    = typeof(ManualBusinessObject);
            var businessObjectType = typeof(SealedBindableObject);

            Assertion.IsTrue(mixinTargetType.IsAssignableFrom(businessObjectType));

            using (MixinConfiguration.BuildNew()
                   .AddMixinToClass(
                       MixinKind.Extending,
                       mixinTargetType,
                       typeof(MixinStub),
                       MemberVisibility.Public,
                       Enumerable.Empty <Type>(),
                       Enumerable.Empty <Type>())
                   .EnterScope())
            {
                IPropertyInformation propertyInfo = GetPropertyInfo(typeof(ClassWithReferenceType <SealedBindableObject>), "Scalar");

                PropertyReflector propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

                var referenceProperty = (IBusinessObjectReferenceProperty)propertyReflector.GetMetadata();
                Assert.That(() => referenceProperty.SupportsSearchAvailableObjects, Throws.Nothing);
            }
        }
Exemplo n.º 3
0
        void IFormItem.AddControl <TValue>(AntInputComponentBase <TValue> control)
        {
            if (control.FieldIdentifier.Model == null)
            {
                throw new InvalidOperationException($"Please use @bind-Value in the control with generic type `{typeof(TValue)}`.");
            }

            this._control = control;

            CurrentEditContext.OnValidationStateChanged += (s, e) =>
            {
                control.ValidationMessages = CurrentEditContext.GetValidationMessages(control.FieldIdentifier).ToArray();
                this._isValid = !control.ValidationMessages.Any();

                StateHasChanged();
            };

            _formValidationMessages = builder =>
            {
                var i = 0;
                builder.OpenComponent <FormValidationMessage <TValue> >(i++);
                builder.AddAttribute(i++, "Control", control);
                builder.CloseComponent();
            };

            _propertyReflector = PropertyReflector.Create(control.ValueExpression);

            if (_propertyReflector.RequiredAttributes.Any())
            {
                _labelCls = $"{_prefixCls}-required";
            }
        }
Exemplo n.º 4
0
        private IBusinessObjectProperty GetMetadataFromPropertyReflector(string propertyName)
        {
            IPropertyInformation propertyInfo      = GetPropertyInfo(typeof(ClassWithAllDataTypes), propertyName);
            PropertyReflector    propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

            return(propertyReflector.GetMetadata());
        }
Exemplo n.º 5
0
        private PropertyBase.Parameters GetPropertyParameters(IPropertyInformation property, BindableObjectProvider provider)
        {
            PropertyReflector reflector = PropertyReflector.Create(property, provider);

            return((PropertyBase.Parameters)PrivateInvoke.InvokeNonPublicMethod(
                       reflector, typeof(PropertyReflector), "CreateParameters", GetUnderlyingType(reflector)));
        }
Exemplo n.º 6
0
        public void Initialize()
        {
            IPropertyInformation propertyInfo = GetPropertyInfo(typeof(ClassWithAllDataTypes), "String");

            PropertyReflector propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

            Assert.That(propertyReflector.PropertyInfo, Is.SameAs(propertyInfo));
            Assert.That(propertyReflector.BusinessObjectProvider, Is.SameAs(_businessObjectProvider));
        }
Exemplo n.º 7
0
        public virtual PropertyReflector CreatePropertyReflector(
            Type concreteType, IPropertyInformation propertyInfo, BindableObjectProvider businessObjectProvider)
        {
            ArgumentUtility.CheckNotNull("concreteType", concreteType);
            ArgumentUtility.CheckNotNull("propertyInfo", propertyInfo);
            ArgumentUtility.CheckNotNull("businessObjectProvider", businessObjectProvider);

            return(PropertyReflector.Create(propertyInfo, businessObjectProvider));
        }
Exemplo n.º 8
0
        void IFormItem.AddControl <TValue>(AntInputComponentBase <TValue> control)
        {
            if (_control != null)
            {
                return;
            }

            if (control.FieldIdentifier.Model == null)
            {
                throw new InvalidOperationException($"Please use @bind-Value (or @bind-Values for selected components) in the control with generic type `{typeof(TValue)}`.");
            }

            _fieldIdentifier = control.FieldIdentifier;
            this._control    = control;


            if (Form.ValidateMode.IsIn(FormValidateMode.Rules, FormValidateMode.Complex))
            {
                _fieldPropertyInfo = _fieldIdentifier.Model.GetType().GetProperty(_fieldIdentifier.FieldName);
            }

            _validationStateChangedHandler = (s, e) =>
            {
                control.ValidationMessages = CurrentEditContext.GetValidationMessages(control.FieldIdentifier).Distinct().ToArray();
                this._isValid = !control.ValidationMessages.Any();

                StateHasChanged();
            };

            CurrentEditContext.OnValidationStateChanged += _validationStateChangedHandler;

            _formValidationMessages = builder =>
            {
                var i = 0;
                builder.OpenComponent <FormValidationMessage <TValue> >(i++);
                builder.AddAttribute(i++, "Control", control);
                builder.CloseComponent();
            };

            if (control.ValueExpression is not null)
            {
                _propertyReflector = PropertyReflector.Create(control.ValueExpression);
            }
            else
            {
                _propertyReflector = PropertyReflector.Create(control.ValuesExpression);
            }

            if (_propertyReflector.RequiredAttribute != null)
            {
                _labelCls = $"{_prefixCls}-required";
            }
            if (_propertyReflector.DisplayName != null)
            {
                Label ??= _propertyReflector.DisplayName;
            }
        }
Exemplo n.º 9
0
        public void GetMetadata_WithEnumBase()
        {
            IPropertyInformation IPropertyInformation = GetPropertyInfo(typeof(ClassWithReferenceType <Enum>), "Scalar");
            PropertyReflector    propertyReflector    = PropertyReflector.Create(IPropertyInformation, _businessObjectProvider);

            IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

            Assert.That(businessObjectProperty, Is.TypeOf(typeof(NotSupportedProperty)));
            Assert.That(businessObjectProperty.Identifier, Is.EqualTo("Scalar"));
        }
Exemplo n.º 10
0
        public void GetMetadata_ForValueType()
        {
            IPropertyInformation propertyInfo = GetPropertyInfo(typeof(ClassWithReferenceType <ValueTypeBindableObject>), "Scalar");

            PropertyReflector propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

            var referenceProperty = (IBusinessObjectReferenceProperty)propertyReflector.GetMetadata();

            Assert.That(() => referenceProperty.SupportsSearchAvailableObjects, Throws.Nothing);
        }
Exemplo n.º 11
0
        public void Initialize_WithMixin()
        {
            IPropertyInformation propertyInfo = GetPropertyInfo(typeof(ClassWithAllDataTypes), "String");

            using (MixinConfiguration.BuildNew().ForClass(typeof(PropertyReflector)).AddMixin <MixinStub> ().EnterScope())
            {
                PropertyReflector propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

                Assert.That(propertyReflector.PropertyInfo, Is.SameAs(propertyInfo));
                Assert.That(propertyReflector.BusinessObjectProvider, Is.SameAs(_businessObjectProvider));
                Assert.That(propertyReflector, Is.InstanceOf(typeof(IMixinTarget)));
            }
        }
Exemplo n.º 12
0
        public void GetPropertyDefinition()
        {
            PropertyReflector propertyReflector =
                PropertyReflector.Create(GetPropertyInfo(typeof(SimpleBusinessObjectClass), "String"), _bindableObjectProvider);
            var classReflector = new ClassReflector(
                typeof(ClassWithAllDataTypes),
                _bindableObjectProvider,
                BindableObjectMetadataFactory.Create(),
                _bindableObjectGlobalizationService);
            BindableObjectClass bindableObjectClass = classReflector.GetMetadata();

            CheckPropertyBase(propertyReflector.GetMetadata(), bindableObjectClass.GetPropertyDefinition("String"));
        }
Exemplo n.º 13
0
        public void GetMetadata_SupportsPredifinedPropertyTypes()
        {
            IPropertyInformation propertyInfo = GetPropertyInfo(typeof(ClassWithAllDataTypes), "Int32");

            using (MixinConfiguration.BuildNew().ForClass(typeof(PropertyReflector)).AddMixin <SimpleReferenceTypePropertyReflectorMixin> ().EnterScope())
            {
                PropertyReflector propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

                IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

                Assert.That(businessObjectProperty, Is.TypeOf(typeof(Int32Property)));
                Assert.That(businessObjectProperty.Identifier, Is.EqualTo("Int32"));
            }
        }
Exemplo n.º 14
0
        public void GetMetadata_DefaultsToBaseImplementation()
        {
            IPropertyInformation propertyInfo = GetPropertyInfo(typeof(ClassWithValueType <SimpleValueType>), "Scalar");

            using (MixinConfiguration.BuildNew().ForClass(typeof(PropertyReflector)).AddMixin <SimpleReferenceTypePropertyReflectorMixin> ().EnterScope())
            {
                PropertyReflector propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

                IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

                Assert.That(businessObjectProperty, Is.TypeOf(typeof(NotSupportedProperty)));
                Assert.That(businessObjectProperty.Identifier, Is.EqualTo("Scalar"));
            }
        }
Exemplo n.º 15
0
        public void GetPropertyDefinition_ForMixedProperty()
        {
            PropertyReflector propertyReflector = PropertyReflector.Create(
                GetPropertyInfo(
                    MixinTypeUtility.GetConcreteMixedType(typeof(ClassWithMixedProperty)),
                    typeof(IMixinAddingProperty).FullName + ".MixedProperty"),
                _bindableObjectProvider);
            var classReflector = new ClassReflector(
                typeof(ClassWithMixedProperty),
                _bindableObjectProvider,
                BindableObjectMetadataFactory.Create(),
                _bindableObjectGlobalizationService);
            BindableObjectClass bindableObjectClass = classReflector.GetMetadata();

            CheckPropertyBase(propertyReflector.GetMetadata(), bindableObjectClass.GetPropertyDefinition("MixedProperty"));
        }
Exemplo n.º 16
0
        public void GetMetadata_WithUndefinedEnum()
        {
            IPropertyInformation IPropertyInformation = GetPropertyInfo(typeof(ClassWithUndefinedEnumValue), "Scalar");
            PropertyReflector    propertyReflector    = PropertyReflector.Create(IPropertyInformation, _businessObjectProvider);

            Assert.That(GetUnderlyingType(propertyReflector), Is.SameAs(typeof(EnumWithUndefinedValue)));

            IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

            Assert.That(businessObjectProperty, Is.InstanceOf(typeof(EnumerationProperty)));
            Assert.That(((PropertyBase)businessObjectProperty).PropertyInfo, Is.SameAs(IPropertyInformation));
            Assert.That(businessObjectProperty.Identifier, Is.EqualTo("Scalar"));
            Assert.That(businessObjectProperty.PropertyType, Is.SameAs(typeof(EnumWithUndefinedValue)));
            Assert.That(businessObjectProperty.IsList, Is.False);
            Assert.That(businessObjectProperty.IsRequired, Is.False);
            Assert.That(businessObjectProperty.IsReadOnly(null), Is.False);
        }
Exemplo n.º 17
0
        protected override void OnInitialized()
        {
            base.OnInitialized();

            if (FieldExpression != null)
            {
                _propertyReflector = PropertyReflector.Create(FieldExpression);
                if (Sortable)
                {
                    SortModel = new SortModel <TData>(_propertyReflector.Value.PropertyInfo, 1, Sort);
                }
            }

            ClassMapper
            .If("ant-table-column-has-sorters", () => Sortable)
            .If($"ant-table-column-sort", () => Sortable && SortModel.SortType.IsIn(SortType.Ascending, SortType.Descending));
        }
Exemplo n.º 18
0
        public void GetMetadata_WithReadOnlyAttributeScalar()
        {
            IPropertyInformation propertyInfo      = GetPropertyInfo(typeof(ClassWithReferenceType <SimpleReferenceType>), "ReadOnlyAttributeScalar");
            PropertyReflector    propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

            Assert.That(GetUnderlyingType(propertyReflector), Is.SameAs(typeof(SimpleReferenceType)));

            IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

            Assert.That(businessObjectProperty, Is.InstanceOf(typeof(PropertyBase)));
            Assert.That(((PropertyBase)businessObjectProperty).PropertyInfo, Is.SameAs(propertyInfo));
            Assert.That(businessObjectProperty.Identifier, Is.EqualTo("ReadOnlyAttributeScalar"));
            Assert.That(businessObjectProperty.PropertyType, Is.SameAs(typeof(SimpleReferenceType)));
            Assert.That(businessObjectProperty.IsList, Is.False);
            Assert.That(businessObjectProperty.IsRequired, Is.False);
            Assert.That(businessObjectProperty.IsReadOnly(null), Is.True);
        }
Exemplo n.º 19
0
        public void GetMetadata_WithListOfT()
        {
            IPropertyInformation IPropertyInformation = GetPropertyInfo(typeof(ClassWithListProperties), "ListOfT");
            PropertyReflector    propertyReflector    = PropertyReflector.Create(IPropertyInformation, _businessObjectProvider);

            Assert.That(GetUnderlyingType(propertyReflector), Is.SameAs(typeof(SimpleReferenceType)));

            IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

            Assert.That(businessObjectProperty, Is.InstanceOf(typeof(NotSupportedProperty)));
            Assert.That(((PropertyBase)businessObjectProperty).PropertyInfo, Is.SameAs(IPropertyInformation));
            Assert.That(businessObjectProperty.Identifier, Is.EqualTo("ListOfT"));
            Assert.That(businessObjectProperty.PropertyType, Is.SameAs(typeof(List <SimpleReferenceType>)));
            Assert.That(businessObjectProperty.IsList, Is.True);
            Assert.That(businessObjectProperty.ListInfo, Is.Not.Null);
            Assert.That(businessObjectProperty.ListInfo.ItemType, Is.SameAs(typeof(SimpleReferenceType)));
            Assert.That(businessObjectProperty.IsRequired, Is.False);
            Assert.That(businessObjectProperty.IsReadOnly(null), Is.False);
        }
Exemplo n.º 20
0
        public void GetMetadata_WithNullableArray()
        {
            IPropertyInformation IPropertyInformation = GetPropertyInfo(typeof(ClassWithValueType <SimpleValueType>), "NullableArray");
            PropertyReflector    propertyReflector    = PropertyReflector.Create(IPropertyInformation, _businessObjectProvider);

            Assert.That(GetUnderlyingType(propertyReflector), Is.SameAs(typeof(SimpleValueType)));

            IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

            Assert.That(businessObjectProperty, Is.InstanceOf(typeof(PropertyBase)));
            Assert.That(((PropertyBase)businessObjectProperty).PropertyInfo, Is.SameAs(IPropertyInformation));
            Assert.That(businessObjectProperty.Identifier, Is.EqualTo("NullableArray"));
            Assert.That(businessObjectProperty.PropertyType, Is.SameAs(typeof(SimpleValueType?[])));
            Assert.That(businessObjectProperty.IsList, Is.True);
            Assert.That(businessObjectProperty.ListInfo, Is.Not.Null);
            Assert.That(businessObjectProperty.ListInfo.ItemType, Is.SameAs(typeof(SimpleValueType?)));
            Assert.That(businessObjectProperty.IsRequired, Is.False);
            Assert.That(businessObjectProperty.IsReadOnly(null), Is.False);
        }
Exemplo n.º 21
0
        protected override void OnInitialized()
        {
            base.OnInitialized();

            Sortable = Sortable || SorterMultiple != default || SorterCompare != default || DefaultSortOrder != default || SortDirections?.Any() == true;

            if (IsHeader)
            {
                if (FieldExpression != null)
                {
                    _propertyReflector = PropertyReflector.Create(FieldExpression);
                }

                if (Sortable)
                {
                    if (_propertyReflector.HasValue)
                    {
                        SortModel = new SortModel <TData>(_propertyReflector.Value.PropertyInfo, SorterMultiple, DefaultSortOrder, SorterCompare);
                    }
                    else
                    {
                        (GetValue, SortModel) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this);
                    }
                }
            }
            else if (IsBody)
            {
                SortModel = Context.HeaderColumns[ColIndex] is IFieldColumn fieldColumn ? fieldColumn.SortModel : null;

                (GetValue, _) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this);
            }

            SortDirections ??= Table.SortDirections;

            Sortable       = Sortable || SortModel != null;
            _sortDirection = SortModel?.SortDirection ?? DefaultSortOrder ?? SortDirection.None;

            ClassMapper
            .If("ant-table-column-has-sorters", () => Sortable)
            .If($"ant-table-column-sort", () => Sortable && SortModel != null && SortModel.SortDirection.IsIn(SortDirection.Ascending, SortDirection.Descending));
        }
Exemplo n.º 22
0
        public void GetMetadata_UsesFactory()
        {
            var mockRepository = new MockRepository();
            var factoryMock    = mockRepository.StrictMock <IMetadataFactory> ();

            IPropertyInformation dummyProperty1 = GetPropertyInfo(typeof(DateTime), "Now");
            IPropertyInformation dummyProperty2 = GetPropertyInfo(typeof(Environment), "TickCount");

            PropertyReflector dummyReflector1 = PropertyReflector.Create(GetPropertyInfo(typeof(DateTime), "Ticks"), _businessObjectProvider);
            PropertyReflector dummyReflector2 = PropertyReflector.Create(GetPropertyInfo(typeof(Environment), "NewLine"), _businessObjectProvider);

            var propertyFinderMock = mockRepository.StrictMock <IPropertyFinder> ();

            var otherClassReflector = new ClassReflector(
                _type,
                _businessObjectProvider,
                factoryMock,
                _bindableObjectGlobalizationService);

            Type concreteType = MixinTypeUtility.GetConcreteMixedType(_type);

            Expect.Call(factoryMock.CreatePropertyFinder(concreteType)).Return(propertyFinderMock);
            Expect.Call(propertyFinderMock.GetPropertyInfos()).Return(new[] { dummyProperty1, dummyProperty2 });
            Expect.Call(factoryMock.CreatePropertyReflector(concreteType, dummyProperty1, _businessObjectProvider)).Return(dummyReflector1);
            Expect.Call(factoryMock.CreatePropertyReflector(concreteType, dummyProperty2, _businessObjectProvider)).Return(dummyReflector2);

            mockRepository.ReplayAll();

            BindableObjectClass theClass = otherClassReflector.GetMetadata();

            Assert.That(theClass.GetPropertyDefinition("Ticks"), Is.Not.Null);
            Assert.That(theClass.GetPropertyDefinition("NewLine"), Is.Not.Null);

            Assert.That(theClass.GetPropertyDefinition("Now"), Is.Null);
            Assert.That(theClass.GetPropertyDefinition("TickCount"), Is.Null);

            mockRepository.VerifyAll();
        }
Exemplo n.º 23
0
        public void GetMetadata_WithReadOnlyMixedPropertyHavingSetterOnMixin()
        {
            IPropertyInformation propertyInfo = GetPropertyInfo(
                MixinTypeUtility.GetConcreteMixedType(typeof(ClassWithMixedProperty)),
                typeof(IMixinAddingProperty),
                "MixedReadOnlyPropertyHavingSetterOnMixin");

            Assertion.IsTrue(propertyInfo is MixinIntroducedPropertyInformation);

            PropertyReflector propertyReflector = PropertyReflector.Create(propertyInfo, _businessObjectProvider);

            Assert.That(GetUnderlyingType(propertyReflector), Is.SameAs(typeof(string)));

            IBusinessObjectProperty businessObjectProperty = propertyReflector.GetMetadata();

            Assert.That(businessObjectProperty, Is.InstanceOf(typeof(PropertyBase)));
            Assert.That(((PropertyBase)businessObjectProperty).PropertyInfo, Is.SameAs(propertyInfo));
            Assert.That(businessObjectProperty.Identifier, Is.EqualTo("MixedReadOnlyPropertyHavingSetterOnMixin"));
            Assert.That(businessObjectProperty.PropertyType, Is.SameAs(typeof(string)));
            Assert.That(businessObjectProperty.IsList, Is.False);
            Assert.That(businessObjectProperty.IsRequired, Is.False);
            Assert.That(businessObjectProperty.IsReadOnly(null), Is.True);
        }
Exemplo n.º 24
0
        private PropertyBase CreateProperty(Type type, string propertyName)
        {
            PropertyReflector propertyReflector = PropertyReflector.Create(GetPropertyInfo(type, propertyName), _bindableObjectProvider);

            return(propertyReflector.GetMetadata());
        }
Exemplo n.º 25
0
        protected override void OnInitialized()
        {
            base.OnInitialized();

            Sortable = Sortable || SorterMultiple != default || SorterCompare != default || DefaultSortOrder != default || SortDirections?.Any() == true;

            if (IsHeader)
            {
                if (FieldExpression != null)
                {
                    _propertyReflector = PropertyReflector.Create(FieldExpression);
                    var paramExp = Expression.Parameter(ItemType);
                    var member   = ColumnExpressionHelper.GetReturnMemberInfo(FieldExpression);
                    var bodyExp  = Expression.MakeMemberAccess(paramExp, member);
                    GetFieldExpression = Expression.Lambda(bodyExp, paramExp);
                }
                else if (DataIndex != null)
                {
                    (_, GetFieldExpression) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this);
                }

                if (Sortable && GetFieldExpression != null)
                {
                    SortModel = new SortModel <TData>(GetFieldExpression, SorterMultiple, DefaultSortOrder, SorterCompare);
                }

                if (GetFieldExpression != null)
                {
                    var member = ColumnExpressionHelper.GetReturnMemberInfo(GetFieldExpression);
                    DisplayName = member.GetCustomAttribute <DisplayNameAttribute>(true)?.DisplayName ?? member.Name;
                    FieldName   = member.Name;
                }
            }
            else if (IsBody)
            {
                SortModel = Context.HeaderColumns[ColIndex] is IFieldColumn fieldColumn ? fieldColumn.SortModel : null;

                (GetValue, _) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this);
            }

            SortDirections ??= Table.SortDirections;

            Sortable        = Sortable || SortModel != null;
            _sortDirection  = SortModel?.SortDirection ?? DefaultSortOrder ?? SortDirection.None;
            _columnDataType = THelper.GetUnderlyingType <TData>();
            if (_columnDataType == typeof(bool) && Filters?.Any() != true)
            {
                Filters = new List <TableFilter <TData> >();

                var trueFilterOption = GetNewFilter();
                trueFilterOption.Text  = Table.Locale.FilterOptions.True;
                trueFilterOption.Value = THelper.ChangeType <TData>(true); //(TData)Convert.ChangeType(true, typeof(TData));
                ((List <TableFilter <TData> >)Filters).Add(trueFilterOption);
                var falseFilterOption = GetNewFilter();
                falseFilterOption.Text  = Table.Locale.FilterOptions.False;
                falseFilterOption.Value = THelper.ChangeType <TData>(false);
                ((List <TableFilter <TData> >)Filters).Add(falseFilterOption);
            }

            if (Filters?.Any() == true)
            {
                Filterable        = true;
                _columnFilterType = TableFilterType.List;
            }
            else if (Filterable)
            {
                _columnFilterType = TableFilterType.FeildType;
                InitFilters();
            }

            ClassMapper
            .If("ant-table-column-has-sorters", () => Sortable)
            .If($"ant-table-column-sort", () => Sortable && SortModel != null && SortModel.SortDirection.IsIn(SortDirection.Ascending, SortDirection.Descending));
        }