Esempio n. 1
0
        public void TestGetMetaEntities()
        {
            var metaDataService = new MetaDataService();
            var metaEntities    = Repository.MetaEntities;

            var foundMetaEntities = metaDataService.GetMetaEntities();

            Assert.AreSame(metaEntities, foundMetaEntities);
        }
        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);
        }