public MethodNodeViewModel(MethodMetadata metadata, IMetadataDetailsProvider metadataDetailsProvider, ILogger logger) { _metadata = metadata; _logger = logger; Name = metadata.Name; Details = metadataDetailsProvider.GetDetails(metadata).ToKeyValuePairList(); }
public static void AddAuthenticatedUserIdAwareMetaDataProvider(this MvcOptions options) { IMetadataDetailsProvider underlyingBindingMetadataProvider = options.ModelMetadataDetailsProviders.Single(x => x is DefaultBindingMetadataProvider); int index = options.ModelMetadataDetailsProviders.IndexOf(underlyingBindingMetadataProvider); options.ModelMetadataDetailsProviders.Remove(underlyingBindingMetadataProvider); options.ModelMetadataDetailsProviders.Insert(index, new AuthenticatedUserIdAwareMetaDataProvider((IBindingMetadataProvider)underlyingBindingMetadataProvider)); }
public static IModelMetadataProvider CreateDefaultProvider() { var detailsProviders = new IMetadataDetailsProvider[] { new DefaultBindingMetadataProvider(), new DefaultValidationMetadataProvider() }; var compositeDetailsProvider = new DefaultCompositeMetadataDetailsProvider(detailsProviders); return(new DefaultModelMetadataProvider(compositeDetailsProvider)); }
public IModelMetadataProvider CreateModelMetadataProvider() { var detailsProviders = new IMetadataDetailsProvider[] { new DefaultBindingMetadataProvider(), new DefaultValidationMetadataProvider(), new DataAnnotationsMetadataProvider(new Mock <IOptions <MvcDataAnnotationsLocalizationOptions> >().Object, null) }; var compositeDetailsProvider = new DefaultCompositeMetadataDetailsProvider(detailsProviders); return(new DefaultModelMetadataProvider(compositeDetailsProvider)); }
// Creates a provider with all the defaults - includes data annotations public static IModelMetadataProvider CreateDefaultProvider() { var detailsProviders = new IMetadataDetailsProvider[] { new DefaultBindingMetadataProvider(CreateMessageProvider()), new DefaultValidationMetadataProvider(), new DataAnnotationsMetadataProvider(), new DataMemberRequiredBindingMetadataProvider(), }; var compositeDetailsProvider = new DefaultCompositeMetadataDetailsProvider(detailsProviders); return(new DefaultModelMetadataProvider(compositeDetailsProvider)); }
public ClassNodeViewModel(TypeMetadata metadata, IMetadataDetailsProvider metadataDetailsProvider, ILogger logger) { _metadata = metadata; _logger = logger; if (_metadata.Methods == null) { _metadata = _metadata.RootAssembly.RegisteredTypes.First(typeMetadata => typeMetadata.TypeHash == _metadata.TypeHash); } Name = metadata.TypeName; Details = metadataDetailsProvider.GetDetails(_metadata).ToKeyValuePairList(); }
public IModelMetadataProvider CreateModelMetadataProvider() { var detailsProviders = new IMetadataDetailsProvider[] { new DefaultBindingMetadataProvider(), new DefaultValidationMetadataProvider(), new DataAnnotationsMetadataProvider( Options.Create(new MvcDataAnnotationsLocalizationOptions()), null) }; var compositeDetailsProvider = new DefaultCompositeMetadataDetailsProvider(detailsProviders); return(new DefaultModelMetadataProvider(compositeDetailsProvider, Options.Create(new MvcOptions()))); }
// Creates a provider with all the defaults - includes data annotations public static IModelMetadataProvider CreateDefaultProvider(IStringLocalizerFactory stringLocalizerFactory = null) { var detailsProviders = new IMetadataDetailsProvider[] { new DefaultBindingMetadataProvider(), new DefaultValidationMetadataProvider(), new DataAnnotationsMetadataProvider( new TestOptionsManager <MvcDataAnnotationsLocalizationOptions>(), stringLocalizerFactory), new DataMemberRequiredBindingMetadataProvider(), }; var compositeDetailsProvider = new DefaultCompositeMetadataDetailsProvider(detailsProviders); return(new DefaultModelMetadataProvider(compositeDetailsProvider, new TestOptionsManager <MvcOptions>())); }
public IModelMetadataProvider CreateModelMetadataProvider() { var detailsProviders = new IMetadataDetailsProvider[] { new DefaultBindingMetadataProvider(), new DefaultValidationMetadataProvider(), new DataAnnotationsMetadataProvider( Options.Create(new MvcDataAnnotationsLocalizationOptions()), null), new BindingSourceMetadataProvider(typeof(CancellationToken), BindingSource.Special), new BindingSourceMetadataProvider(typeof(IFormFile), BindingSource.FormFile), new BindingSourceMetadataProvider(typeof(IFormFileCollection), BindingSource.FormFile), new BindingSourceMetadataProvider(typeof(IEnumerable <IFormFile>), BindingSource.FormFile) }; var compositeDetailsProvider = new DefaultCompositeMetadataDetailsProvider(detailsProviders); return(new DefaultModelMetadataProvider(compositeDetailsProvider, Options.Create(new MvcOptions()))); }