Exemple #1
0
        public void TestInitializeMetaEntity()
        {
            var metaDataService = new MetaDataService();
            var metaEntity      = Repository.MetaEntities.First();

            var entity = metaDataService.InitializeMetaEntity(metaEntity);

            Assert.NotNull(entity);
            Assert.AreEqual(INTEGER_DEFAULT_VALUE, entity.Id);
            Assert.AreEqual(STRING_DEFAULT_VALUE, entity.Label);
        }
        public void Initialize(IMetaEntity metaEntity)
        {
            MetaFieldTemplate = EntityService.GetMetaEntity(nameof(IMetaFieldTemplate));
            EntityValidator   = EntityService.GetEntityValidator(MetaFieldTemplate);
            var metaMetaField = EntityService.GetMetaEntity(nameof(IMetaField));

            if (metaEntity == null)
            {
                metaEntity = MetaDataService.InitializeMetaEntity(MetaFieldTemplate);
            }
            else
            {
                metaEntity = EntityService.GetMetaEntity(metaEntity.Id);
            }
            Caption = MdManagerLabels.MetaFieldTemplateLabel;

            Entity = metaEntity;
        }
        public void Initialize(IMetaEntity metaEntity)
        {
            var metaMetaEntity = EntityService.GetMetaEntity(nameof(IMetaEntity));

            EntityValidator = EntityService.GetEntityValidator(metaMetaEntity);
            var metaMetaField      = EntityService.GetMetaEntity(nameof(IMetaField));
            var metaFieldValidator = EntityService.GetEntityValidator(metaMetaField);

            if (metaEntity == null)
            {
                metaEntity = MetaDataService.InitializeMetaEntity(metaMetaEntity);
            }
            else
            {
                metaEntity = EntityService.GetMetaEntity(metaEntity.Id);
            }
            Caption = EntityValidator.MetaEntity.Label;
            Entity  = metaEntity;
            MetaFieldListPanelViewModel = EntityListPanelViewModel.Create(RefreshMetaFields, null, OpenMetaFieldEdition,
                                                                          DeleteMetaField, metaFieldValidator);

            MetaBooleanMetaField         = EntityService.GetMetaEntity(nameof(IBooleanMetaField));
            CreateBooleanMetaFieldLabel  = string.Format(MdManagerLabels.CreateEntityLabel, MetaBooleanMetaField.Label);
            MetaIntegerMetaField         = EntityService.GetMetaEntity(nameof(IIntegerMetaField));
            CreateIntegerMetaFieldLabel  = string.Format(MdManagerLabels.CreateEntityLabel, MetaIntegerMetaField.Label);
            MetaDecimalMetaField         = EntityService.GetMetaEntity(nameof(IDecimalMetaField));
            CreateDecimalMetaFieldLabel  = string.Format(MdManagerLabels.CreateEntityLabel, MetaDecimalMetaField.Label);
            MetaDateTimeMetaField        = EntityService.GetMetaEntity(nameof(IDateTimeMetaField));
            CreateDateTimeMetaFieldLabel =
                string.Format(MdManagerLabels.CreateEntityLabel, MetaDateTimeMetaField.Label);
            MetaStringMetaField        = EntityService.GetMetaEntity(nameof(IStringMetaField));
            CreateStringMetaFieldLabel = string.Format(MdManagerLabels.CreateEntityLabel, MetaStringMetaField.Label);
            MetaEntityMetaField        = EntityService.GetMetaEntity(nameof(IEntityMetaField));
            CreateEntityMetaFieldLabel = string.Format(MdManagerLabels.CreateEntityLabel, MetaEntityMetaField.Label);

            InitializeFieldValidators(metaEntity);
        }