Пример #1
0
        private static ISelectListProvider GetProvider(PropertyInfo propertyInfo)
        {
            var typeProviding = propertyInfo
                                .GetAttribute <CheckboxListAttribute>()
                                .SelectListProvider;

            return(SelectListProviderFactory.GetDefault(typeProviding));
        }
        public override object ValueFromModelPropertyConvention(PropertyInfo propertyInfo, object model, string parentName)
        {
            object selectedValue = propertyInfo.GetValue(model, null);

            Type typeProviding = propertyInfo
                                 .GetAttribute <SelectListProvidedAttribute>()
                                 .SelectListProvider;

            ISelectListProvider provider = SelectListProviderFactory.GetDefault(typeProviding);

            return(provider.Provide(selectedValue));
        }