Пример #1
0
        public XCustomTypeDescriptor(object entity)
        {
            _entity        = entity;
            _entityType    = _entity.GetType();
            TypeDescriptor = XTypeDescriptor.Get(_entityType);

            _lazyProperties = new Lazy <PropertyDescriptorCollection>(
                () =>
            {
                var properties = new List <XPropertyDescriptor>();

                properties.AddRange(
                    TypeDescriptor.PropertiesOfMetadataPropertyDescriptor
                    .Select(prop => new XPropertyDescriptor(prop, null, this)));

                return(new PropertyDescriptorCollection(properties.Cast <PropertyDescriptor>().ToArray()));
            });
        }
        public EntityValidationHelper()
        {
            TypeDescriptor = XTypeDescriptor.Get <TEntity>();

            Validations = new List <ValidationResult>();
        }