Exemplo n.º 1
0
            public DefaultModelBinderProviderContext(
                DefaultModelBinderFactory factory,
                ModelBinderFactoryContext factoryContext)
            {
                _factory    = factory;
                Metadata    = factoryContext.Metadata;
                BindingInfo = new BindingInfo
                {
                    BinderModelName        = factoryContext.BindingInfo?.BinderModelName ?? Metadata.BinderModelName,
                    BinderType             = factoryContext.BindingInfo?.BinderType ?? Metadata.BinderType,
                    BindingSource          = factoryContext.BindingInfo?.BindingSource ?? Metadata.BindingSource,
                    PropertyFilterProvider =
                        factoryContext.BindingInfo?.PropertyFilterProvider ?? Metadata.PropertyFilterProvider,
                };

                MetadataProvider = _factory._metadataProvider;
                Visited          = new Dictionary <Key, IIndexModelBinder>();
            }
Exemplo n.º 2
0
            private DefaultModelBinderProviderContext(
                DefaultModelBinderProviderContext parent,
                ModelMetadata metadata)
            {
                Metadata = metadata;

                _factory         = parent._factory;
                MetadataProvider = parent.MetadataProvider;
                Visited          = parent.Visited;

                BindingInfo = new BindingInfo()
                {
                    BinderModelName        = metadata.BinderModelName,
                    BinderType             = metadata.BinderType,
                    BindingSource          = metadata.BindingSource,
                    PropertyFilterProvider = metadata.PropertyFilterProvider,
                };
            }
Exemplo n.º 3
0
        public IndexModelBinder(
            IModelMetadataProvider modelMetadataProvider,
            IObjectIndexModelValidator validator,
            IOptions <IndexOptions> options)
        {
            if (modelMetadataProvider == null)
            {
                throw new ArgumentNullException(nameof(modelMetadataProvider));
            }

            if (validator == null)
            {
                throw new ArgumentNullException(nameof(validator));
            }

            _modelMetadataProvider = modelMetadataProvider;
            _validator             = validator;
            _modelBinderFactory    = new DefaultModelBinderFactory(_modelMetadataProvider, options);
        }