Ejemplo n.º 1
0
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            Ensure.That(context, nameof(context)).IsNotNull();

            return(typeof(IHaveFilters).IsAssignableFrom(context.Metadata.ModelType)
                ? new FiltersModelBinder(_workerProvider.GetBinder(context))
                : null);
        }
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            if (context.BindingInfo.BindingSource != null &&
                context.BindingInfo.BindingSource.CanAcceptDataFrom(_bindingSource) &&
                CommandInterfaceType.IsAssignableFrom(context.Metadata.ModelType))
            {
                IModelBinder modelBinder = _decoratedModelBinderProvider.GetBinder(context);
                return(new ClaimsMappingModelBinder(modelBinder, _commandClaimsBinderProvider));
            }

            return(null);
        }
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            var httpMethod = _httpContextAccessor.HttpContext.Request.Method;

            if ((httpMethod == HttpMethods.Get || httpMethod == HttpMethods.Delete) && !_httpContextAccessor.HttpContext.Request.QueryString.HasValue)
            {
                if (context.Metadata.IsComplexType && !context.Metadata.IsCollectionType)
                {
                    return(new RouteDataComplexTypeModelBinder(_complexTypeModelBinderProvider.GetBinder(context)));
                }
            }
            return(null);
        }
Ejemplo n.º 4
0
 public IModelBinder GetBinder(ModelBinderProviderContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (context.Metadata.IsComplexType && !context.Metadata.IsCollectionType)
     {
         return(new TransformationModelBinder(context.CreateBinder,
                                              InterfacesModelBinderProvider.GetBinder(context) ??
                                              originalComplexModelBinderProvider.GetBinder(context),
                                              context.MetadataProvider));
     }
     return(null);
 }
        /// <inheritdoc/>
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (typeof(IExaminationValidationModel).IsAssignableFrom(context.Metadata.ModelType))
            {
                var originalModelBinder = _originalModelBinderProvider.GetBinder(context);

                return(new ExaminationValidationModelBinder(originalModelBinder));
            }

            return(null);
        }
Ejemplo n.º 6
0
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            IModelBinder modelBinder = _decoratedProvider.GetBinder(context);

            return(modelBinder == null ? null : new AuthenticatedUserIdAwareBodyModelBinder(_decoratedProvider.GetBinder(context)));
        }
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            var underlyingModelBinderProvider = _underlyingModelBinderProvider.GetBinder(context);

            return(new CustomValidationModelBinder(underlyingModelBinderProvider));
        }