public async Task BindModelAsync(ModelBindingContext bindingContext) { var actualDiscriminatorValue = await _reader.ReadDiscriminatorAsync(_discriminator.Property, bindingContext.HttpContext); if (null == actualDiscriminatorValue) { throw new CouldNotReadDiscriminatorException(); } var resolvedType = Fn.CreateResolver(_cases)(actualDiscriminatorValue); if (null == resolvedType) { throw new UnresolvableDiscriminatorCaseException(actualDiscriminatorValue); } var metadataForResolvedType = _metadataProvider.GetMetadataForType(resolvedType); var modelBinderForResolvedType = _factory.CreateBinder(new ModelBinderFactoryContext { Metadata = metadataForResolvedType, BindingInfo = new BindingInfo { BindingSource = bindingContext.BindingSource, BinderModelName = bindingContext.BinderModelName } }); if (null == modelBinderForResolvedType) { throw new CouldNotResolveBinderForTypeException(resolvedType); } bindingContext.ModelMetadata = metadataForResolvedType; await modelBinderForResolvedType.BindModelAsync(bindingContext); }