protected override void InitializeFieldValidators(IStringMetaField metaField)
        {
            base.InitializeFieldValidators(metaField);

            IFieldValidator fieldValidator = GetFieldValidator <int?>(nameof(IStringMetaField.MinLength));

            MinLengthFieldItemViewModel =
                TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaField.MinLength.ToString());
            EditableItemsFields.Add(MinLengthFieldItemViewModel);
            fieldValidator = GetFieldValidator <int?>(nameof(IStringMetaField.MaxLength));
            MaxLengthFieldItemViewModel =
                TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaField.MaxLength.ToString());
            EditableItemsFields.Add(MaxLengthFieldItemViewModel);
            fieldValidator = GetFieldValidator <int?>(nameof(IStringMetaField.DisplayedLinesCount));
            DisplayedLinesCountFieldItemViewModel = TextBoxFieldItemViewModel.Create(fieldValidator, Entity,
                                                                                     metaField.DisplayedLinesCount.ToString());
            EditableItemsFields.Add(DisplayedLinesCountFieldItemViewModel);
            fieldValidator = GetFieldValidator <string>(nameof(IStringMetaField.DefaultValue));
            DefaultValueFieldItemViewModel =
                TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaField.DefaultValue);
            EditableItemsFields.Add(DefaultValueFieldItemViewModel);
            fieldValidator = GetFieldValidator <IEntity>(nameof(IStringMetaField.RegularExpression));
            var regularExpressions          = MetaDataService.GetRegularExpressions().OrderBy(me => me.Label).ToList();
            var regularExpressionViewModels = regularExpressions.Select(RegularExpressionItemViewModel.Create);

            EntityRegularExpressionFieldItemViewModel =
                EntityFieldItemViewModel.Create(fieldValidator, Entity,
                                                regularExpressionViewModels, metaField.RegularExpression);
            EditableItemsFields.Add(EntityRegularExpressionFieldItemViewModel);
        }
        protected override void InitializeFieldValidators(IEntityMetaField metaField)
        {
            base.InitializeFieldValidators(metaField);

            IFieldValidator fieldValidator = GetFieldValidator <int?>(nameof(IEntityMetaField.DefaultValueId));

            DefaultValueIdFieldItemViewModel =
                TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaField.DefaultValueId.ToString());
            EditableItemsFields.Add(DefaultValueIdFieldItemViewModel);
            fieldValidator = GetFieldValidator <IEntity>(nameof(IEntityMetaField.ValueType));
            var metaEntities         = MetaDataService.GetMetaEntities().OrderBy(me => me.Label).ToList();
            var metaEntityViewModels = metaEntities.Select(MetaEntityItemViewModel.Create);
            var metaEntity           = metaEntities.SingleOrDefault(me => me.Id == metaField.ValueType?.Id);

            ValueTypeFieldItemViewModel =
                EntityFieldItemViewModel.Create(fieldValidator, Entity, metaEntityViewModels, metaEntity);
            EditableItemsFields.Add(ValueTypeFieldItemViewModel);
        }
        private void InitializeFieldValidators(IMetaEntity metaEntity)
        {
            IFieldValidator fieldValidator = GetFieldValidator <string>(nameof(IMetaEntity.InterfaceName));

            InterfaceNameFieldItemViewModel =
                TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaEntity.InterfaceName);
            EditableItemsFields.Add(InterfaceNameFieldItemViewModel);
            fieldValidator          = GetFieldValidator <string>(nameof(IMetaEntity.Label));
            LabelFieldItemViewModel = TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaEntity.Label);
            EditableItemsFields.Add(LabelFieldItemViewModel);
            fieldValidator = GetFieldValidator <string>(nameof(IMetaEntity.PlurialLabel));
            PlurialLabelFieldItemViewModel =
                TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaEntity.PlurialLabel);
            EditableItemsFields.Add(PlurialLabelFieldItemViewModel);
            fieldValidator = GetFieldValidator <bool?>(nameof(IMetaEntity.IsMasculine));
            IsMasculineFieldItemViewModel =
                CheckBoxFieldItemViewModel.Create(fieldValidator, Entity, metaEntity.IsMasculine);
            EditableItemsFields.Add(IsMasculineFieldItemViewModel);
            fieldValidator = GetFieldValidator <string>(nameof(IMetaEntity.Description));
            DescriptionFieldItemViewModel =
                TextBoxFieldItemViewModel.Create(fieldValidator, Entity, metaEntity.Description);
            EditableItemsFields.Add(DescriptionFieldItemViewModel);

            var metaField = ModelFactory.CreateMetaField(
                "MetaFieldTemplate",
                "Ajouter un méta-champ",
                "Choisissez un model de méta champ");

            var metaFieldTemplates          = MetaDataService.GetMetaFieldTemplates().OrderBy(me => me.Label).ToList();
            var metaFieldTemplateViewModels = metaFieldTemplates.Select(MetaFieldItemTemplateViewModel.Create);

            fieldValidator = ModelFactory.CreateFieldValidator <IEntity>(metaField);
            EntityService.CreateFieldValidator(fieldValidator);
            MetaFieldTemplateItemViewModel =
                EntityFieldItemViewModel.Create(fieldValidator, Entity, metaFieldTemplateViewModels, metaField);
            EditableItemsFields.Add(MetaFieldTemplateItemViewModel);
        }