internal static IModelBinder GetBinderFromAttributes(Type type, Func <string> errorMessageAccessor)
        {
            AttributeCollection allAttrs = TypeDescriptorHelper.Get(type).GetAttributes();

            CustomModelBinderAttribute[] filteredAttrs = allAttrs.OfType <CustomModelBinderAttribute>().ToArray();
            return(GetBinderFromAttributesImpl(filteredAttrs, errorMessageAccessor));
        }
Example #2
0
        private TypeInformation CreateTypeInformation(Type type)
        {
            TypeInformation       info           = new TypeInformation();
            ICustomTypeDescriptor typeDescriptor = TypeDescriptorHelper.Get(type);

            info.TypeDescriptor = typeDescriptor;
            info.Prototype      = CreateMetadataPrototype(
                AsAttributes(typeDescriptor.GetAttributes()),
                containerType: null,
                modelType: type,
                propertyName: null
                );

            Dictionary <string, PropertyInformation> properties =
                new Dictionary <string, PropertyInformation>();

            foreach (PropertyDescriptor property in typeDescriptor.GetProperties())
            {
                // Avoid re-generating a property descriptor if one has already been generated for the property name
                if (!properties.ContainsKey(property.Name))
                {
                    properties.Add(property.Name, CreatePropertyInformation(type, property));
                }
            }
            info.Properties = properties;

            return(info);
        }
Example #3
0
        static ControllerBase()
        {
            TypeDescriptorHelper.RegisterMetadataType(typeof(Repository), typeof(Repository_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Schema), typeof(Schema_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Column), typeof(Column_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Folder), typeof(Folder_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(TextFolder), typeof(TextFolder_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(MediaFolder), typeof(MediaFolder_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(MediaContent), typeof(MediaContent_Metadata));
            //TypeDescriptorHelper.RegisterMetadataType(typeof(BroadcastSetting), typeof(BroadcastSetting_Metadata));
            //TypeDescriptorHelper.RegisterMetadataType(typeof(ReceivedMessage), typeof(ReceivedMessage_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(ReceivingSetting), typeof(ReceivingSetting_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(SendingSetting), typeof(SendingSetting_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(VersionInfo), typeof(VersionInfo_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Workflow), typeof(Workflow_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(PendingWorkflowItem), typeof(PendingWorkflowItem_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(WorkflowHistory), typeof(WorkflowHistory_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Kooboo.CMS.Search.Models.SearchSetting), typeof(Kooboo.CMS.Web.Areas.Contents.Models.SearchSetting_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Kooboo.CMS.Content.Models.OrderSetting), typeof(OrderSetting_Metadata));

            TypeDescriptorHelper.RegisterMetadataType(typeof(Kooboo.CMS.Search.Models.FolderIndexInfo), typeof(FolderIndexInfo_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Kooboo.CMS.Search.Models.LastAction), typeof(LastAction_Metadata));

            TypeDescriptorHelper.RegisterMetadataType(typeof(MediaContentMetadata), typeof(MediaContentMetadata_Metadata));
        }
        internal static void GetRequiredPropertiesCollection(Type modelType, out HashSet <string> requiredProperties, out HashSet <string> skipProperties)
        {
            requiredProperties = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            skipProperties     = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            // Use attributes on the property before attributes on the type.
            ICustomTypeDescriptor        modelDescriptor     = TypeDescriptorHelper.Get(modelType);
            PropertyDescriptorCollection propertyDescriptors = modelDescriptor.GetProperties();
            BindingBehaviorAttribute     typeAttr            = modelDescriptor.GetAttributes().OfType <BindingBehaviorAttribute>().SingleOrDefault();

            foreach (PropertyDescriptor propertyDescriptor in propertyDescriptors)
            {
                BindingBehaviorAttribute propAttr    = propertyDescriptor.Attributes.OfType <BindingBehaviorAttribute>().SingleOrDefault();
                BindingBehaviorAttribute workingAttr = propAttr ?? typeAttr;
                if (workingAttr != null)
                {
                    switch (workingAttr.Behavior)
                    {
                    case BindingBehavior.Required:
                        requiredProperties.Add(propertyDescriptor.Name);
                        break;

                    case BindingBehavior.Never:
                        skipProperties.Add(propertyDescriptor.Name);
                        break;
                    }
                }
            }
        }
        private static bool TryGetProviderFromAttributes(Type modelType, out ModelBinderProvider provider)
        {
            ModelBinderAttribute attr = TypeDescriptorHelper.Get(modelType).GetAttributes().OfType <ModelBinderAttribute>().FirstOrDefault();

            if (attr == null)
            {
                provider = null;
                return(false);
            }

            // TODO, 386718, remove the following if statement when the bug is resolved
            if (attr.BinderType == null)
            {
                provider = null;
                return(false);
            }

            if (typeof(ModelBinderProvider).IsAssignableFrom(attr.BinderType))
            {
                provider = (ModelBinderProvider)Activator.CreateInstance(attr.BinderType);
            }
            else
            {
                throw Error.InvalidOperation(SRResources.ModelBinderProviderCollection_InvalidBinderType, attr.BinderType.Name, typeof(ModelBinderProvider).Name, typeof(IModelBinder).Name);
            }

            return(true);
        }
        private static bool TryGetProviderFromAttributes(Type modelType, out ModelBinderProvider provider)
        {
            ExtensibleModelBinderAttribute attr = TypeDescriptorHelper.Get(modelType).GetAttributes().OfType <ExtensibleModelBinderAttribute>().FirstOrDefault();

            if (attr == null)
            {
                provider = null;
                return(false);
            }

            if (typeof(ModelBinderProvider).IsAssignableFrom(attr.BinderType))
            {
                provider = (ModelBinderProvider)Activator.CreateInstance(attr.BinderType);
            }
            else if (typeof(IExtensibleModelBinder).IsAssignableFrom(attr.BinderType))
            {
                Type closedBinderType = (attr.BinderType.IsGenericTypeDefinition) ? attr.BinderType.MakeGenericType(modelType.GetGenericArguments()) : attr.BinderType;
                IExtensibleModelBinder binderInstance = (IExtensibleModelBinder)Activator.CreateInstance(closedBinderType);
                provider = new SimpleModelBinderProvider(modelType, binderInstance)
                {
                    SuppressPrefixCheck = attr.SuppressPrefixCheck
                };
            }
            else
            {
                string errorMessage = String.Format(CultureInfo.CurrentCulture, MvcResources.ModelBinderProviderCollection_InvalidBinderType,
                                                    attr.BinderType, typeof(ModelBinderProvider), typeof(IExtensibleModelBinder));
                throw new InvalidOperationException(errorMessage);
            }

            return(true);
        }
        protected virtual void SetProperty(ControllerContext controllerContext, ExtensibleModelBindingContext bindingContext, ModelMetadata propertyMetadata, ComplexModelDtoResult dtoResult)
        {
            PropertyDescriptor propertyDescriptor = TypeDescriptorHelper.Get(bindingContext.ModelType).GetProperties().Find(propertyMetadata.PropertyName, true /* ignoreCase */);

            if (propertyDescriptor == null || propertyDescriptor.IsReadOnly)
            {
                return; // nothing to do
            }

            object value = dtoResult.Model ?? GetPropertyDefaultValue(propertyDescriptor);

            propertyMetadata.Model = value;

            // 'Required' validators need to run first so that we can provide useful error messages if
            // the property setters throw, e.g. if we're setting entity keys to null. See comments in
            // DefaultModelBinder.SetProperty() for more information.
            if (value == null)
            {
                string modelStateKey = dtoResult.ValidationNode.ModelStateKey;
                if (bindingContext.ModelState.IsValidField(modelStateKey))
                {
                    ModelValidator requiredValidator = ModelValidatorProviders.Providers.GetValidators(propertyMetadata, controllerContext).Where(v => v.IsRequired).FirstOrDefault();
                    if (requiredValidator != null)
                    {
                        foreach (ModelValidationResult validationResult in requiredValidator.Validate(bindingContext.Model))
                        {
                            bindingContext.ModelState.AddModelError(modelStateKey, validationResult.Message);
                        }
                    }
                }
            }

            if (value != null || TypeHelpers.TypeAllowsNullValue(propertyDescriptor.PropertyType))
            {
                try
                {
                    propertyDescriptor.SetValue(bindingContext.Model, value);
                }
                catch (Exception ex)
                {
                    // don't display a duplicate error message if a binding error has already occurred for this field
                    string modelStateKey = dtoResult.ValidationNode.ModelStateKey;
                    if (bindingContext.ModelState.IsValidField(modelStateKey))
                    {
                        bindingContext.ModelState.AddModelError(modelStateKey, ex);
                    }
                }
            }
            else
            {
                // trying to set a non-nullable value type to null, need to make sure there's a message
                string modelStateKey = dtoResult.ValidationNode.ModelStateKey;
                if (bindingContext.ModelState.IsValidField(modelStateKey))
                {
                    dtoResult.ValidationNode.Validated += CreateNullCheckFailedHandler(controllerContext, propertyMetadata, value);
                }
            }
        }
Example #8
0
        internal static void GetRequiredPropertiesCollection(
            HttpActionContext actionContext,
            ModelBindingContext bindingContext,
            out HashSet <string> requiredProperties,
            out Dictionary <string, ModelValidator> requiredValidators,
            out HashSet <string> skipProperties
            )
        {
            requiredProperties = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            requiredValidators = new Dictionary <string, ModelValidator>(
                StringComparer.OrdinalIgnoreCase
                );
            skipProperties = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            // Use attributes on the property before attributes on the type.
            ICustomTypeDescriptor modelDescriptor = TypeDescriptorHelper.Get(
                bindingContext.ModelType
                );
            PropertyDescriptorCollection propertyDescriptors = modelDescriptor.GetProperties();
            HttpBindingBehaviorAttribute typeAttr            = modelDescriptor
                                                               .GetAttributes()
                                                               .OfType <HttpBindingBehaviorAttribute>()
                                                               .SingleOrDefault();

            foreach (PropertyDescriptor propertyDescriptor in propertyDescriptors)
            {
                string         propertyName      = propertyDescriptor.Name;
                ModelMetadata  propertyMetadata  = bindingContext.PropertyMetadata[propertyName];
                ModelValidator requiredValidator = actionContext
                                                   .GetValidators(propertyMetadata)
                                                   .Where(v => v.IsRequired)
                                                   .FirstOrDefault();
                requiredValidators[propertyName] = requiredValidator;

                HttpBindingBehaviorAttribute propAttr = propertyDescriptor.Attributes
                                                        .OfType <HttpBindingBehaviorAttribute>()
                                                        .SingleOrDefault();
                HttpBindingBehaviorAttribute workingAttr = propAttr ?? typeAttr;
                if (workingAttr != null)
                {
                    switch (workingAttr.Behavior)
                    {
                    case HttpBindingBehavior.Required:
                        requiredProperties.Add(propertyName);
                        break;

                    case HttpBindingBehavior.Never:
                        skipProperties.Add(propertyName);
                        break;
                    }
                }
                else if (requiredValidator != null)
                {
                    requiredProperties.Add(propertyName);
                }
            }
        }
Example #9
0
 protected override System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor(Type type)
 {
     var descriptor = TypeDescriptorHelper.Get(type);
     if (descriptor == null)
     {
         descriptor = base.GetTypeDescriptor(type);
     }
     return descriptor;
 }
Example #10
0
        public Form1()
        {
            InitializeComponent();

            TypeDescriptorHelper.RegistMetadata <ProductNewProduct, ProductNewProductMetadata>();

            this.LoadMethods();
            this.cmbMethods.SelectedIndexChanged += cmbMethods_SelectedIndexChanged;
        }
 private static void EnsureNoBindAttribute(Type modelType)
 {
     if (TypeDescriptorHelper.Get(modelType).GetAttributes().OfType <BindAttribute>().Any())
     {
         string errorMessage = String.Format(CultureInfo.CurrentCulture, MvcResources.ModelBinderProviderCollection_TypeCannotHaveBindAttribute,
                                             modelType);
         throw new InvalidOperationException(errorMessage);
     }
 }
Example #12
0
        public Form1()
        {
            InitializeComponent();
            this.dgDestAccounts.DataSource = this.DestAccounts;
            var logger = this.Logger;

            TypeDescriptorHelper.SetNotBrowserableForComplexProperty <DestAccount>();
            TypeDescriptorHelper.MappingSubLevelProperty <DestAccount>(a => a.ProductGroup.Name, a => a.FrightTemplate.Name);
            TypeDescriptorHelper.RegistMetadata <Product, ProductMetadata>();
        }
Example #13
0
        private static ModelBinderAttribute GetModelBinderAttribute(Type modelType)
        {
            ModelBinderAttribute modelBinderAttribute;

            if (!_modelBinderAttributeCache.TryGetValue(modelType, out modelBinderAttribute))
            {
                modelBinderAttribute = TypeDescriptorHelper.Get(modelType).GetAttributes().OfType <ModelBinderAttribute>().FirstOrDefault();
                _modelBinderAttributeCache.TryAdd(modelType, modelBinderAttribute);
            }
            return(modelBinderAttribute);
        }
Example #14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += Application_ThreadException;

            //TypeDescriptorHelper.SetDisplayAttributFromResource<OrderQueryList>(AsNum.Aliexpress.API.Res.Resource.ResourceManager);
            TypeDescriptorHelper.AutoSetDisplayAttributeFromResource("AsNum.Aliexpress.API", AsNum.Xmj.API.Res.Resource.ResourceManager);

            Application.Run(new Form1());
        }
Example #15
0
        internal static bool TryGetProviderFromAttributes(Type modelType, out ModelBinderProvider provider)
        {
            ModelBinderAttribute attr = TypeDescriptorHelper.Get(modelType).GetAttributes().OfType <ModelBinderAttribute>().FirstOrDefault();

            if (attr == null)
            {
                provider = null;
                return(false);
            }

            return(TryGetProviderFromAttribute(modelType, attr, out provider));
        }
Example #16
0
        static ControllerBase()
        {
            #region ModelBinder
            System.Web.Mvc.ModelBinders.Binders.Add(typeof(IDataRule), new DataRuleBinder());
            System.Web.Mvc.ModelBinders.Binders.Add(typeof(DataRuleBase), new DataRuleBinder());
            System.Web.Mvc.ModelBinders.Binders.Add(typeof(PagePosition), new PagePositionBinder());
            System.Web.Mvc.ModelBinders.Binders.Add(typeof(Parameter), new ParameterBinder());
            #endregion

            TypeDescriptorHelper.RegisterMetadataType(typeof(Site), typeof(Site_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Security), typeof(Security_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(CustomError), typeof(CustomError_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Layout), typeof(Layout_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Template), typeof(Template_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(PathResource), typeof(PathResource_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Kooboo.CMS.Sites.Models.View), typeof(View_Metadata));

            #region Page Metadata
            TypeDescriptorHelper.RegisterMetadataType(typeof(Page), typeof(Page_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(PagePosition), typeof(PagePosition_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(ViewPosition), typeof(ViewPosition_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(HtmlPosition), typeof(HtmlPosition_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(ModulePosition), typeof(ModulePosition_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Navigation), typeof(Navigation_Metadata));
            #endregion
            TypeDescriptorHelper.RegisterMetadataType(typeof(FileResource), typeof(FileResource_Metadata));
            #region Theme Metadata
            TypeDescriptorHelper.RegisterMetadataType(typeof(Theme), typeof(Theme_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(StyleFile), typeof(Style_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(ThemeImageFile), typeof(ThemeImageFile_Metadata));
            #endregion
            TypeDescriptorHelper.RegisterMetadataType(typeof(CustomFile), typeof(CustomFile_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(ScriptFile), typeof(ScriptFile_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(ScriptFile), typeof(ScriptFile_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(UrlRedirect), typeof(UrlRedirect_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Kooboo.Globalization.Element), typeof(Element_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(HtmlMeta), typeof(HtmlMeta_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(PageRoute), typeof(Pageroute_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(UrlKeyMap), typeof(UrlKeyMap_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(AssemblyFile), typeof(AssemblyFile_Metadata));
            //TypeDescriptorHelper.RegisterMetadataType(typeof(Type), typeof(Type_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(ModuleInfo), typeof(ModuleInfo_Metadata));

            TypeDescriptorHelper.RegisterMetadataType(typeof(DataRuleSetting), typeof(DataRuleSetting_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(DataRuleBase), typeof(DataRuleBase_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(User), typeof(Kooboo.CMS.Web.Areas.Sites.Models.User_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(Smtp), typeof(Kooboo.CMS.Web.Areas.Sites.Models.Smtp_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(PagePublishingQueueItem), typeof(PagePublishingQueue_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(VersionInfo), typeof(VersionInfo_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(HtmlBlock), typeof(HtmlBlock_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(DiagnosisResult), typeof(DiagnosisResult_Metadata));
            TypeDescriptorHelper.RegisterMetadataType(typeof(WebApplicationInformation), typeof(WebApplicationInformation_Metadata));
        }
Example #17
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            TypeDescriptorHelper.AutoSetDisplayAttributeFromResource("AsNum.Aliexpress.API", Resource.ResourceManager);

            Container.LoadConfiguration();

            Application.ThreadException += Application_ThreadException;
            var form = Container.Resolve <Form1>();

            Application.Run(form);
        }
Example #18
0
        internal static bool IsRequiredDataMember(Type containerType, IEnumerable <Attribute> attributes)
        {
            DataMemberAttribute dataMemberAttribute = attributes.OfType <DataMemberAttribute>().FirstOrDefault();

            if (dataMemberAttribute != null)
            {
                // isDataContract == true iff the container type has at least one DataContractAttribute
                bool isDataContract = TypeDescriptorHelper.Get(containerType).GetAttributes().OfType <DataContractAttribute>().Any();
                if (isDataContract && dataMemberAttribute.IsRequired)
                {
                    return(true);
                }
            }
            return(false);
        }
        private TypeInformation CreateTypeInformation(Type type)
        {
            TypeInformation       info           = new TypeInformation();
            ICustomTypeDescriptor typeDescriptor = TypeDescriptorHelper.Get(type);

            info.TypeDescriptor = typeDescriptor;
            info.Prototype      = CreateMetadataPrototype(AsAttributes(typeDescriptor.GetAttributes()), containerType: null, modelType: type, propertyName: null);

            Dictionary <string, PropertyInformation> properties = new Dictionary <string, PropertyInformation>();

            foreach (PropertyDescriptor property in typeDescriptor.GetProperties())
            {
                properties.Add(property.Name, CreatePropertyInformation(type, property));
            }
            info.Properties = properties;

            return(info);
        }
Example #20
0
        protected TableMapperBase(MappingOptions mappingOptions)
        {
            MappingOptions = mappingOptions ?? throw new ArgumentException(nameof(mappingOptions));

            switch (mappingOptions.MappingMode)
            {
            case MappingMode.ByName:
                RowMapper = new ColumnNamesRowMapper <T>();
                break;

            case MappingMode.ByNumber:
                RowMapper = new ColumnNumbersRowMapper <T>();
                break;

            default:
                throw new ArgumentOutOfRangeException(
                          nameof(mappingOptions.MappingMode), mappingOptions.MappingMode, null);
            }

            TypeDescriptorHelper <T> .AddProviderTransparent();
        }
Example #21
0
        public void GetCachedPropertyDescriptors(Type type, string propertyNames)
        {
            var propertyList = TypeDescriptorHelper.GetCachedPropertyDescriptors(type)
                               .OfType <System.ComponentModel.PropertyDescriptor>();
            var propertyKeysArr = propertyList.Select(x => x.Name).ToArray();
            var propertyNameArr = propertyNames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                  .Select(x => x.Trim())
                                  .ToArray();

            if (propertyKeysArr.Length == propertyNameArr.Length)
            {
                for (int i = 0; i < propertyKeysArr.Length; i++)
                {
                    Assert.AreEqual(propertyNameArr[i], propertyKeysArr[i]);
                }
            }
            else
            {
                Assert.Fail("Type {0} - Expected:<{1}>. Actual:<{2}>. ", type, string.Join(", ", propertyNameArr), string.Join(", ", propertyKeysArr));
            }
        }
Example #22
0
        internal static bool TryGetProviderFromAttributes(HttpParameterDescriptor parameterDescriptor, out ModelBinderProvider provider)
        {
            Contract.Assert(parameterDescriptor != null, "parameterDescriptor cannot be null.");

            Type modelType = parameterDescriptor.ParameterType;

            ModelBinderAttribute attr = parameterDescriptor.GetCustomAttributes <ModelBinderAttribute>().FirstOrDefault();

            if (attr == null)
            {
                attr = TypeDescriptorHelper.Get(modelType).GetAttributes().OfType <ModelBinderAttribute>().FirstOrDefault();
            }

            if (attr == null)
            {
                provider = null;
                return(false);
            }

            return(TryGetProviderFromAttribute(modelType, attr, out provider));
        }
Example #23
0
 static ControllerBase()
 {
     TypeDescriptorHelper.RegisterMetadataType(typeof(Role), typeof(Role_Metadata));
     TypeDescriptorHelper.RegisterMetadataType(typeof(User), typeof(User_Metadata));
     TypeDescriptorHelper.RegisterMetadataType(typeof(Setting), typeof(Setting_Metadata));
 }
Example #24
0
 static AdminControllerBase()
 {
     TypeDescriptorHelper.RegisterMetadataType(typeof(ModuleSettings), typeof(Kooboo.CMS.ModuleArea.Models.ModuleSettings_Metadata));
 }
Example #25
0
 protected virtual ICustomTypeDescriptor GetTypeDescriptor(Type type)
 {
     return(TypeDescriptorHelper.Get(type));
 }