334 references to GetMetadata
CookieSample (1)
Program.cs (1)
24var authData = context.HttpContext.GetEndpoint()?.Metadata.GetMetadata<IAuthorizeData>();
Microsoft.AspNetCore.Antiforgery (1)
AntiforgeryMiddleware.cs (1)
31if (endpoint?.Metadata.GetMetadata<IAntiforgeryMetadata>() is { RequiresValidation: true })
Microsoft.AspNetCore.Authorization.Policy (1)
AuthorizationMiddleware.cs (1)
172if (endpoint?.Metadata.GetMetadata<IAllowAnonymous>() != null)
Microsoft.AspNetCore.Components.Endpoints (8)
Assets\ImportMap.cs (1)
52_computedImportMapDefinition = ImportMapDefinition ?? HttpContext?.GetEndpoint()?.Metadata.GetMetadata<ImportMapDefinition>();
Builder\RazorComponentEndpointDataSource.cs (1)
135var resourceCollection = endpoints.Count > 0 ? endpoints[^1].Metadata.GetMetadata<ResourceAssetCollection>() : null;
Builder\RazorComponentsEndpointHttpContextExtensions.cs (1)
33var pageType = context.GetEndpoint()?.Metadata.GetMetadata<ComponentTypeMetadata>()?.Type;
RazorComponentEndpointInvoker.cs (1)
59var antiforgeryMetadata = endpoint.Metadata.GetMetadata<IAntiforgeryMetadata>();
Rendering\EndpointHtmlRenderer.cs (2)
136endpoint.Metadata.GetMetadata<ResourceCollectionUrlMetadata>() : 154private static ResourceAssetCollection? GetResourceCollection(HttpContext httpContext) => httpContext.GetEndpoint()?.Metadata.GetMetadata<ResourceAssetCollection>();
Rendering\EndpointHtmlRenderer.PrerenderingState.cs (1)
25var renderModesMetadata = httpContext.GetEndpoint()?.Metadata.GetMetadata<ConfiguredRenderModesMetadata>();
Rendering\SSRRenderModeBoundary.cs (1)
54var configuredRenderModesMetadata = httpContext.GetEndpoint()?.Metadata.GetMetadata<ConfiguredRenderModesMetadata>();
Microsoft.AspNetCore.Components.Endpoints.Tests (21)
Builder\RazorComponentsEndpointConventionBuilderExtensionsTest.cs (10)
31if (e.Metadata.GetMetadata<ComponentTypeMetadata>() == null) 36var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 55var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 74var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 95var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 117var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 139var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 162var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 188var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 214var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>();
HotReloadServiceTests.cs (11)
50Assert.Single(endpointDataSource.Endpoints, e => e.Metadata.GetMetadata<RootComponentMetadata>() != null)); 67var pageEndpoints = endpointDataSource.Endpoints.Where(e => e.Metadata.GetMetadata<RootComponentMetadata>() != null).ToList(); 85e => e.Metadata.GetMetadata<RootComponentMetadata>() != null)); 95var pageEndpoints = endpointDataSource.Endpoints.Where(e => e.Metadata.GetMetadata<RootComponentMetadata>() != null).ToList(); 108var endpoint = Assert.IsType<RouteEndpoint>(Assert.Single(endpointDataSource.Endpoints, e => e.Metadata.GetMetadata<RootComponentMetadata>() != null)); 118var updatedEndpoint = Assert.IsType<RouteEndpoint>(Assert.Single(endpointDataSource.Endpoints, e => e.Metadata.GetMetadata<RootComponentMetadata>() != null)); 134var endpoint = Assert.IsType<RouteEndpoint>(Assert.Single(endpointDataSource.Endpoints, e => e.Metadata.GetMetadata<RootComponentMetadata>() != null)); 136var compositeEndpoint = Assert.IsType<RouteEndpoint>(Assert.Single(compositeEndpointDataSource.Endpoints, e => e.Metadata.GetMetadata<RootComponentMetadata>() != null)); 145var pageEndpoints = endpointDataSource.Endpoints.Where(e => e.Metadata.GetMetadata<RootComponentMetadata>() != null).ToList(); 146var compositePageEndpoints = compositeEndpointDataSource.Endpoints.Where(e => e.Metadata.GetMetadata<RootComponentMetadata>() != null).ToList(); 183var endpoint = Assert.IsType<RouteEndpoint>(Assert.Single(endpointDataSource.Endpoints, e => e.Metadata.GetMetadata<RootComponentMetadata>() != null));
Microsoft.AspNetCore.Components.Server (1)
ComponentHub.cs (1)
126var resourceCollection = Context.GetHttpContext().GetEndpoint()?.Metadata.GetMetadata<ResourceAssetCollection>();
Microsoft.AspNetCore.Cors (1)
Infrastructure\CorsMiddleware.cs (1)
114var corsMetadata = endpoint?.Metadata.GetMetadata<ICorsMetadata>();
Microsoft.AspNetCore.Cors.Test (3)
CorsEndpointConventionBuilderExtensionsTests.cs (3)
27var metadata = endpoint.Metadata.GetMetadata<IEnableCorsAttribute>(); 48var metadata = endpoint.Metadata.GetMetadata<ICorsPolicyMetadata>(); 70var metadata = endpoint.Metadata.GetMetadata<IEnableCorsAttribute>();
Microsoft.AspNetCore.Diagnostics (2)
DeveloperExceptionPage\DeveloperExceptionPageMiddlewareImpl.cs (1)
354var httpMethods = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods;
StatusCodePage\StatusCodePagesMiddleware.cs (1)
82var skipStatusCodePageMetadata = endpoint?.Metadata.GetMetadata<ISkipStatusCodePagesMetadata>();
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Logging\IncomingHttpRouteUtility.cs (1)
43var parameters = endpoint?.Metadata.GetMetadata<ControllerActionDescriptor>()?.Parameters;
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (13)
JsonTranscodingServiceMethodProviderTests.cs (13)
30Assert.Equal("GET", endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single()); 46Assert.Equal("HEAD", endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single()); 61Assert.Equal("GET", getMethodModel.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single()); 62Assert.Equal("/v1/additional_bindings/{name}", getMethodModel.Metadata.GetMetadata<GrpcJsonTranscodingMetadata>()?.HttpRule.Get); 66Assert.Equal("DELETE", additionalMethodModel.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single()); 67Assert.Equal("/v1/additional_bindings/{name}", additionalMethodModel.Metadata.GetMetadata<GrpcJsonTranscodingMetadata>()?.HttpRule.Delete); 81Assert.Equal("POST", startFrameImport.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single()); 82Assert.Equal("/v1/frames:startFrameImport", startFrameImport.Metadata.GetMetadata<GrpcJsonTranscodingMetadata>()?.HttpRule.Post); 85Assert.Equal("POST", getFrameImport.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single()); 86Assert.Equal("/v1/frames:getFrameImport", getFrameImport.Metadata.GetMetadata<GrpcJsonTranscodingMetadata>()?.HttpRule.Post); 157Assert.Equal("GET", endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single()); 158Assert.Equal("/v1/server_greeter/{name}", endpoint.Metadata.GetMetadata<GrpcJsonTranscodingMetadata>()?.HttpRule.Get); 237.Where(e => e.Metadata.GetMetadata<GrpcMethodMetadata>()?.Method.Name == methodName)
Microsoft.AspNetCore.Grpc.Swagger (3)
Internal\GrpcJsonTranscodingDescriptionProvider.cs (3)
43var grpcMetadata = endpoint.Metadata.GetMetadata<GrpcJsonTranscodingMetadata>(); 92var explorerSettings = routeEndpoint.Metadata.GetMetadata<ApiExplorerSettingsAttribute>(); 98var methodMetadata = routeEndpoint.Metadata.GetMetadata<GrpcMethodMetadata>()!;
Microsoft.AspNetCore.Hosting (2)
Internal\HostingApplicationDiagnostics.cs (2)
161var disableHttpRequestDurationMetric = endpoint?.Metadata.GetMetadata<IDisableHttpMetricsMetadata>() != null || context.MetricsTagsFeature.MetricsDisabled; 162var route = endpoint?.Metadata.GetMetadata<IRouteDiagnosticsMetadata>()?.Route;
Microsoft.AspNetCore.Http (3)
Timeouts\RequestTimeoutsMiddleware.cs (3)
37var timeoutMetadata = endpoint?.Metadata.GetMetadata<RequestTimeoutAttribute>(); 38var policyMetadata = endpoint?.Metadata.GetMetadata<RequestTimeoutPolicy>(); 47var disableMetadata = endpoint?.Metadata.GetMetadata<DisableRequestTimeoutAttribute>();
Microsoft.AspNetCore.Http.Abstractions (1)
Routing\EndpointMetadataCollection.cs (1)
140var metadata = GetMetadata<T>();
Microsoft.AspNetCore.Http.Connections.Tests (8)
MapConnectionHandlerTests.cs (8)
303var metaData = endpoint.Metadata.GetMetadata<NegotiateMetadata>(); 305var optionsMetaData = endpoint.Metadata.GetMetadata<HttpConnectionDispatcherOptions>(); 311Assert.Null(endpoint.Metadata.GetMetadata<NegotiateMetadata>()); 339var metaData = endpoint.Metadata.GetMetadata<NegotiateMetadata>(); 341var optionsMetaData = endpoint.Metadata.GetMetadata<HttpConnectionDispatcherOptions>(); 350Assert.Null(endpoint.Metadata.GetMetadata<NegotiateMetadata>()); 373Assert.NotNull(endpoint.Metadata.GetMetadata<IEnableCorsAttribute>()); 378Assert.NotNull(endpoint.Metadata.GetMetadata<IEnableCorsAttribute>());
Microsoft.AspNetCore.Http.Extensions.Tests (2)
ProblemDetailsServiceTest.cs (2)
157var metadata = context.AdditionalMetadata?.GetMetadata<SampleMetadata>() ?? 158context.HttpContext.GetEndpoint()?.Metadata.GetMetadata<SampleMetadata>();
Microsoft.AspNetCore.HttpLogging (1)
HttpLoggingMiddleware.cs (1)
58var loggingAttribute = context.GetEndpoint()?.Metadata.GetMetadata<HttpLoggingAttribute>();
Microsoft.AspNetCore.HttpLogging.Tests (1)
HttpLoggingEndpointConventionBuilderTests.cs (1)
30var metadata = endpoint.Metadata.GetMetadata<HttpLoggingAttribute>();
Microsoft.AspNetCore.Mvc.ApiExplorer (6)
EndpointMetadataApiDescriptionProvider.cs (6)
61routeEndpoint.Metadata.GetMetadata<MethodInfo>() is { } methodInfo && 62routeEndpoint.Metadata.GetMetadata<IHttpMethodMetadata>() is { } httpMethodMetadata && 63routeEndpoint.Metadata.GetMetadata<IExcludeFromDescriptionMetadata>() is null or { ExcludeFromDescription: false }) 103GroupName = routeEndpoint.Metadata.GetMetadata<IEndpointGroupNameMetadata>()?.EndpointGroupName, 133var acceptsMetadata = routeEndpoint.Metadata.GetMetadata<IAcceptsMetadata>(); 331var errorMetadata = endpointMetadata.GetMetadata<ProducesErrorResponseTypeAttribute>();
Microsoft.AspNetCore.Mvc.Core (17)
Authorization\AuthorizeFilter.cs (1)
225if (endpoint?.Metadata?.GetMetadata<IAllowAnonymous>() != null)
Infrastructure\ActionSelectionTable.cs (2)
91getRouteKeys: e => e.Metadata.GetMetadata<ActionDescriptor>()?.RouteValues?.Keys, 95e.Metadata.GetMetadata<ActionDescriptor>()?.RouteValues?.TryGetValue(key, out value);
Infrastructure\DefaultApiProblemDetailsWriter.cs (4)
37var controllerAttribute = context.AdditionalMetadata?.GetMetadata<ControllerAttribute>() ?? 38context.HttpContext.GetEndpoint()?.Metadata.GetMetadata<ControllerAttribute>(); 45var apiControllerAttribute = context.AdditionalMetadata?.GetMetadata<IApiBehaviorMetadata>() ?? 46context.HttpContext.GetEndpoint()?.Metadata.GetMetadata<IApiBehaviorMetadata>();
Routing\ActionConstraintMatcherPolicy.cs (3)
41var action = endpoint.Metadata.GetMetadata<ActionDescriptor>(); 137var actionDescriptor = endpoint.Metadata.GetMetadata<ActionDescriptor>(); 221var dataTokens = candidate.Endpoint.Metadata.GetMetadata<IDataTokensMetadata>()?.DataTokens;
Routing\ActionEndpointFactory.cs (2)
528var dataTokens = endpoint.Metadata.GetMetadata<IDataTokensMetadata>(); 534var action = endpoint.Metadata.GetMetadata<ActionDescriptor>()!;
Routing\DynamicControllerEndpointMatcherPolicy.cs (4)
42if (endpoints[i].Metadata.GetMetadata<DynamicControllerMetadata>() != null) 48if (endpoints[i].Metadata.GetMetadata<DynamicControllerRouteValueTransformerMetadata>() != null) 83var dynamicControllerMetadata = endpoint.Metadata.GetMetadata<DynamicControllerMetadata>(); 84var transformerMetadata = endpoint.Metadata.GetMetadata<DynamicControllerRouteValueTransformerMetadata>();
Routing\DynamicControllerEndpointSelectorCache.cs (1)
28var dataSourceId = endpoint.Metadata.GetMetadata<ControllerEndpointDataSourceIdMetadata>()!;
Microsoft.AspNetCore.Mvc.Core.Test (53)
Routing\ActionEndpointFactoryTest.cs (4)
48var routeNameMetadata = endpoint.Metadata.GetMetadata<IRouteNameMetadata>(); 254Assert.Equal("Test", endpoint.Metadata.GetMetadata<IRouteNameMetadata>().RouteName); 255Assert.Equal("Test", endpoint.Metadata.GetMetadata<IEndpointNameMetadata>().EndpointName); 495var isEndpointSuppressed = endpoint.Metadata.GetMetadata<ISuppressMatchingMetadata>()?.SuppressMatching ?? false;
Routing\ControllerActionEndpointDataSourceTest.cs (49)
95Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 100Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 108Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 109Assert.Equal("1", e.Metadata.GetMetadata<IRouteNameMetadata>().RouteName); 110Assert.Equal("1", e.Metadata.GetMetadata<IEndpointNameMetadata>().EndpointName); 115Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 116Assert.Equal("2", e.Metadata.GetMetadata<IRouteNameMetadata>().RouteName); 117Assert.Equal("2", e.Metadata.GetMetadata<IEndpointNameMetadata>().EndpointName); 122Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 123Assert.Equal("Test", e.Metadata.GetMetadata<IRouteNameMetadata>().RouteName); 124Assert.Equal("Test", e.Metadata.GetMetadata<IEndpointNameMetadata>().EndpointName); 177Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 178Assert.Equal("Hi there", e.Metadata.GetMetadata<string>()); 183Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 184Assert.Equal("Hi there", e.Metadata.GetMetadata<string>()); 192Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 193Assert.Equal("Hi there", e.Metadata.GetMetadata<string>()); 198Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 199Assert.Equal("Hi there", e.Metadata.GetMetadata<string>()); 204Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 205Assert.Equal("Hi there", e.Metadata.GetMetadata<string>()); 264Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 269Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 277Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 278Assert.Equal("1", e.Metadata.GetMetadata<IRouteNameMetadata>().RouteName); 279Assert.Equal("1", e.Metadata.GetMetadata<IEndpointNameMetadata>().EndpointName); 284Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 285Assert.Equal("2", e.Metadata.GetMetadata<IRouteNameMetadata>().RouteName); 286Assert.Equal("2", e.Metadata.GetMetadata<IEndpointNameMetadata>().EndpointName); 291Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 292Assert.Equal("Test", e.Metadata.GetMetadata<IRouteNameMetadata>().RouteName); 293Assert.Equal("NewName", e.Metadata.GetMetadata<IEndpointNameMetadata>().EndpointName); 346Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 352Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 361Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 367Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 373Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 374Assert.Equal("Hi there", e.Metadata.GetMetadata<string>()); 440Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 442Assert.NotNull(e.Metadata.GetMetadata<GroupMetadata>()); 447Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 449Assert.NotNull(e.Metadata.GetMetadata<GroupMetadata>()); 457Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 460Assert.NotNull(e.Metadata.GetMetadata<GroupMetadata>()); 465Assert.Null(e.Metadata.GetMetadata<ActionDescriptor>()); 467Assert.NotNull(e.Metadata.GetMetadata<GroupMetadata>()); 472Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 475Assert.NotNull(e.Metadata.GetMetadata<GroupMetadata>()); 548return !(endpoint.Metadata.GetMetadata<ISuppressLinkGenerationMetadata>()?.SuppressLinkGeneration == true);
Microsoft.AspNetCore.Mvc.Razor (1)
TagHelpers\UrlResolutionTagHelper.cs (1)
340return ViewContext.HttpContext.GetEndpoint()?.Metadata.GetMetadata<ResourceAssetCollection>();
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (3)
PageLoaderMatcherPolicy.cs (3)
44var page = endpoints[i].Metadata.GetMetadata<PageActionDescriptor>(); 70var page = endpoint.Metadata.GetMetadata<PageActionDescriptor>(); 111var page = endpoint.Metadata.GetMetadata<PageActionDescriptor>();
Microsoft.AspNetCore.Mvc.RazorPages (6)
Infrastructure\DynamicPageEndpointMatcherPolicy.cs (5)
45if (endpoints[i].Metadata.GetMetadata<DynamicPageMetadata>() != null) 51if (endpoints[i].Metadata.GetMetadata<DynamicPageRouteValueTransformerMetadata>() != null) 85var dynamicPageMetadata = endpoint.Metadata.GetMetadata<DynamicPageMetadata>(); 86var transformerMetadata = endpoint.Metadata.GetMetadata<DynamicPageRouteValueTransformerMetadata>(); 160var actionDescriptor = metadata.GetMetadata<PageActionDescriptor>();
Infrastructure\DynamicPageEndpointSelectorCache.cs (1)
34var dataSourceId = endpoint.Metadata.GetMetadata<PageEndpointDataSourceIdMetadata>();
Microsoft.AspNetCore.Mvc.RazorPages.Test (16)
Builder\PageActionEndpointConventionBuilderResourceCollectionExtensionsTest.cs (8)
33var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 54var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 75var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 97var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 120var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 143var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 169var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 195var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>();
Infrastructure\PageActionEndpointDataSourceTest.cs (8)
88Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 89Assert.Equal("Hi there", e.Metadata.GetMetadata<string>()); 158Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 160Assert.NotNull(e.Metadata.GetMetadata<GroupMetadata>()); 165Assert.Same(actions[1], e.Metadata.GetMetadata<ActionDescriptor>()); 167Assert.NotNull(e.Metadata.GetMetadata<GroupMetadata>()); 208Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>()); 256Assert.Same(actions[0], e.Metadata.GetMetadata<ActionDescriptor>());
Microsoft.AspNetCore.Mvc.TagHelpers (2)
ResourceCollectionUtilities.cs (1)
15var assetCollection = viewContext.HttpContext.GetEndpoint()?.Metadata.GetMetadata<ResourceAssetCollection>();
ScriptTagHelper.cs (1)
247var importMap = ImportMap ?? ViewContext.HttpContext.GetEndpoint()?.Metadata.GetMetadata<ImportMapDefinition>();
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (24)
Builder\ControllerActionEndpointConventionBuilderResourceCollectionExtensionsTest.cs (24)
33var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 36var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 41var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 63var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 66var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 71var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 94var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 97var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 102var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 125var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 128var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 133var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 157var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 160var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 165var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 189var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 192var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 197var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 224var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 227var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 232var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 259var apiController = e.Metadata.GetMetadata<ApiControllerAttribute>(); 262var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>(); 267var metadata = e.Metadata.GetMetadata<ResourceAssetCollection>();
Microsoft.AspNetCore.OpenApi (7)
Services\OpenApiGenerator.cs (7)
62if (metadata.GetMetadata<IHttpMethodMetadata>() is { } httpMethodMetadata && 64metadata.GetMetadata<IExcludeFromDescriptionMetadata>() is null or { ExcludeFromDescription: false }) 77OperationId = metadata.GetMetadata<IEndpointNameMetadata>()?.EndpointName, 78Summary = metadata.GetMetadata<IEndpointSummaryMetadata>()?.Summary, 79Description = metadata.GetMetadata<IEndpointDescriptionMetadata>()?.Description, 112var errorMetadata = metadata.GetMetadata<ProducesErrorResponseTypeAttribute>(); 272var acceptsMetadata = metadata.GetMetadata<IAcceptsMetadata>();
Microsoft.AspNetCore.OpenApi.Tests (7)
Extensions\OpenApiRouteHandlerBuilderExtensionTests.cs (7)
34var operation = endpoint.Metadata.GetMetadata<OpenApiOperation>(); 57var operation = endpoint.Metadata.GetMetadata<OpenApiOperation>(); 84var operation = endpoint.Metadata.GetMetadata<OpenApiOperation>(); 115e => Assert.NotNull(e.Metadata.GetMetadata<OpenApiOperation>()), 116e => Assert.NotNull(e.Metadata.GetMetadata<OpenApiOperation>())); 138var operation = endpoint.Metadata.GetMetadata<OpenApiOperation>(); 176var operation = endpoint.Metadata.GetMetadata<OpenApiOperation>();
Microsoft.AspNetCore.OutputCaching (2)
OutputCacheMiddleware.cs (2)
228var policy = metadata?.GetMetadata<IOutputCachePolicy>(); 236var attribute = metadata?.GetMetadata<OutputCacheAttribute>();
Microsoft.AspNetCore.RateLimiting (3)
RateLimitingMiddleware.cs (3)
69if (endpoint?.Metadata.GetMetadata<DisableRateLimitingAttribute>() is not null) 73var enableRateLimitingAttribute = endpoint?.Metadata.GetMetadata<EnableRateLimitingAttribute>(); 258var enableRateLimitingAttribute = context.GetEndpoint()?.Metadata.GetMetadata<EnableRateLimitingAttribute>();
Microsoft.AspNetCore.RateLimiting.Tests (3)
RateLimiterEndpointConventionBuilderExtensionsTests.cs (3)
29var metadata = endpoint.Metadata.GetMetadata<EnableRateLimitingAttribute>(); 51var metadata = endpoint.Metadata.GetMetadata<EnableRateLimitingAttribute>(); 73var metadata = endpoint.Metadata.GetMetadata<DisableRateLimitingAttribute>();
Microsoft.AspNetCore.RequestDecompression (1)
RequestDecompressionMiddleware.cs (1)
62context.GetEndpoint()?.Metadata?.GetMetadata<IRequestSizeLimitMetadata>()?.MaxRequestBodySize
Microsoft.AspNetCore.Routing (34)
EndpointDataSource.cs (2)
108var routeNameMetadata = routeEndpoint.Metadata.GetMetadata<IRouteNameMetadata>(); 123var httpMethodMetadata = routeEndpoint.Metadata.GetMetadata<IHttpMethodMetadata>();
EndpointMiddleware.cs (3)
41if (endpoint.Metadata.GetMetadata<IAuthorizeData>() is not null && 47if (endpoint.Metadata.GetMetadata<ICorsMetadata>() is not null && 53if (endpoint.Metadata.GetMetadata<IAntiforgeryMetadata>() is { RequiresValidation: true } &&
EndpointNameAddressScheme.cs (2)
96if (endpoint.Metadata.GetMetadata<ISuppressLinkGenerationMetadata>()?.SuppressLinkGeneration == true) 102return endpoint.Metadata.GetMetadata<IEndpointNameMetadata>()?.EndpointName;
EndpointRoutingMiddleware.cs (7)
120var isFallback = endpoint.Metadata.GetMetadata<FallbackMetadata>() is not null; 131var route = endpoint.Metadata.GetMetadata<IRouteDiagnosticsMetadata>()?.Route ?? "(missing)"; 140var shortCircuitMetadata = endpoint.Metadata.GetMetadata<ShortCircuitMetadata>(); 163if (endpoint.Metadata.GetMetadata<IAuthorizeData>() is not null) 168if (endpoint.Metadata.GetMetadata<ICorsMetadata>() is not null) 173if (endpoint.Metadata.GetMetadata<IAntiforgeryMetadata>() is { RequiresValidation: true } && 304var sizeLimitMetadata = context.GetEndpoint()?.Metadata?.GetMetadata<IRequestSizeLimitMetadata>();
Internal\DfaGraphWriter.cs (1)
47if (endpoints[i] is RouteEndpoint endpoint && (endpoint.Metadata.GetMetadata<ISuppressMatchingMetadata>()?.SuppressMatching ?? false) == false)
Matching\AcceptsMatcherPolicy.cs (4)
44return endpoints.Any(e => e.Metadata.GetMetadata<IAcceptsMetadata>()?.ContentTypes.Count > 0); 61var metadata = candidates[i].Endpoint?.Metadata.GetMetadata<IAcceptsMetadata>(); 154var contentTypes = endpoint.Metadata.GetMetadata<IAcceptsMetadata>()?.ContentTypes; 176var contentTypes = endpoint.Metadata.GetMetadata<IAcceptsMetadata>()?.ContentTypes ?? Array.Empty<string>();
Matching\ContentEncodingNegotiationMatcherPolicy.cs (3)
13private protected override bool HasMetadata(Endpoint endpoint) => endpoint.Metadata.GetMetadata<ContentEncodingMetadata>() != null; 15private protected override string? GetMetadataValue(Endpoint endpoint) => endpoint.Metadata.GetMetadata<ContentEncodingMetadata>()?.Value; 25var metadata = endpoint.Metadata.GetMetadata<ContentEncodingMetadata>();
Matching\DataSourceDependentMatcher.cs (2)
50var endpointName = endpoint.Metadata.GetMetadata<IEndpointNameMetadata>()?.EndpointName; 64if (endpoint.Metadata.GetMetadata<ISuppressMatchingMetadata>()?.SuppressMatching != true)
Matching\EndpointMetadataComparer.cs (1)
109return endpoint.Metadata.GetMetadata<TMetadata>();
Matching\HostMatcherPolicy.cs (3)
50var hosts = e.Metadata.GetMetadata<IHostMetadata>()?.Hosts; 83var hosts = candidates[i].Endpoint.Metadata.GetMetadata<IHostMetadata>()?.Hosts; 275var hostMetadata = endpoint.Metadata.GetMetadata<IHostMetadata>();
Matching\HttpMethodMatcherPolicy.cs (3)
63if (endpoints[i].Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Count > 0) 99var metadata = candidates[i].Endpoint?.Metadata.GetMetadata<IHttpMethodMetadata>(); 300var metadata = e.Metadata.GetMetadata<IHttpMethodMetadata>();
Matching\MatcherPolicy.cs (1)
53var metadata = endpoints[i].Metadata.GetMetadata<IDynamicEndpointMetadata>();
RouteValuesAddressScheme.cs (2)
100var metadata = endpoint.Metadata.GetMetadata<IRouteNameMetadata>(); 106if (endpoint.Metadata.GetMetadata<ISuppressLinkGenerationMetadata>()?.SuppressLinkGeneration == true)
Microsoft.AspNetCore.Routing.Microbenchmarks (5)
EndpointMetadataCollectionBenchmark.cs (5)
76GC.KeepAlive(_collection.GetMetadata<IMetadata1>()); 77GC.KeepAlive(_collection.GetMetadata<IMetadata2>()); 78GC.KeepAlive(_collection.GetMetadata<IMetadata3>()); 79GC.KeepAlive(_collection.GetMetadata<IMetadata4>()); 80GC.KeepAlive(_collection.GetMetadata<IMetadata5>());
Microsoft.AspNetCore.Routing.Tests (57)
Builder\GroupTest.cs (5)
37var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 69var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 103var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 351Assert.Equal("/group", routeEndpoint.Metadata.GetMetadata<string>()); 357Assert.Equal("/group", routeEndpoint.Metadata.GetMetadata<string>());
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (1)
420Assert.Equal("BUILDER", endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()?.HttpMethods.Single());
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (25)
89Assert.Equal("BUILDER", endpoint.Metadata.GetMetadata<IHttpMethodMetadata>()!.HttpMethods.Single()); 102var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 122var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 148var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 186var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 270var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 290var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 310var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 334var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 354var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 374var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 398var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 418var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 438var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 472var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 493var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 523var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 564var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 668var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 688var endpointMetadata = endpoint.Metadata.GetMetadata<IAcceptsMetadata>(); 706var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 726var methodMetadata = endpoint.Metadata.GetMetadata<IHttpMethodMetadata>(); 782var tagsMetadata = endpoint.Metadata.GetMetadata<ITagsMetadata>(); 797var endpointName = endpoint.Metadata.GetMetadata<IEndpointNameMetadata>(); 798var routeName = endpoint.Metadata.GetMetadata<IRouteNameMetadata>();
Builder\RoutingEndpointConventionBuilderExtensionsTest.cs (6)
44var metadata = endpoint.Metadata.GetMetadata<IHostMetadata>(); 115var hosts = endpoint.Metadata.GetMetadata<IHostMetadata>(); 119var @string = endpoint.Metadata.GetMetadata<string>(); 149var endpointName = endpoint.Metadata.GetMetadata<IEndpointNameMetadata>(); 152var routeName = endpoint.Metadata.GetMetadata<IRouteNameMetadata>(); 168var endpointGroupName = endpoint.Metadata.GetMetadata<IEndpointGroupNameMetadata>();
CompositeEndpointDataSourceTest.cs (10)
360Assert.NotNull(endpoint.Metadata.GetMetadata<IEndpointNameMetadata>()); 361Assert.Equal("initial-metadata", endpoint.Metadata.GetMetadata<string>()); 367Assert.NotNull(endpoint.Metadata.GetMetadata<IEndpointNameMetadata>()); 368Assert.Equal("initial-metadata", endpoint.Metadata.GetMetadata<string>()); 415Assert.NotNull(endpoint.Metadata.GetMetadata<IEndpointNameMetadata>()); 416Assert.Equal("initial-metadata", endpoint.Metadata.GetMetadata<string>()); 422Assert.NotNull(endpoint.Metadata.GetMetadata<IEndpointNameMetadata>()); 423Assert.Equal("initial-metadata", endpoint.Metadata.GetMetadata<string>()); 481Assert.NotNull(endpoint.Metadata.GetMetadata<IEndpointNameMetadata>()); 488Assert.NotNull(endpoint.Metadata.GetMetadata<IEndpointNameMetadata>());
DefaultLinkGeneratorTest.cs (1)
745return _dataSource.Endpoints.Where(e => e.Metadata.GetMetadata<IntMetadata>().Value == address);
DefaultLinkParserTest.cs (1)
174return _dataSource.Endpoints.Where(e => e.Metadata.GetMetadata<IntMetadata>().Value == address);
Matching\DfaMatcherBuilderTest.cs (6)
3593return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata1>() != null); 3605.GroupBy(e => e.Metadata.GetMetadata<TestMetadata1>().State) 3635return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata2>() != null); 3647.GroupBy(e => e.Metadata.GetMetadata<TestMetadata2>().State) 3661return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata1>() != null); 3672.GroupBy(e => e.Metadata.GetMetadata<TestMetadata1>().State)
RouteEndpointBuilderTest.cs (2)
93var httpMethodMetadata = endpoint.Metadata.GetMetadata<HttpMethodMetadata>(); 134var httpMethodMetadata = endpoint.Metadata.GetMetadata<HttpMethodMetadata>();
Microsoft.AspNetCore.SignalR.Tests (8)
MapSignalRTests.cs (8)
323Assert.Equal(typeof(AuthHub), endpoint.Metadata.GetMetadata<HubMetadata>()?.HubType); 324Assert.NotNull(endpoint.Metadata.GetMetadata<NegotiateMetadata>()); 329Assert.Equal(typeof(AuthHub), endpoint.Metadata.GetMetadata<HubMetadata>()?.HubType); 330Assert.Null(endpoint.Metadata.GetMetadata<NegotiateMetadata>()); 354Assert.Equal(typeof(AuthHub), endpoint.Metadata.GetMetadata<HubMetadata>()?.HubType); 355Assert.NotNull(endpoint.Metadata.GetMetadata<NegotiateMetadata>()); 360Assert.Equal(typeof(AuthHub), endpoint.Metadata.GetMetadata<HubMetadata>()?.HubType); 361Assert.Null(endpoint.Metadata.GetMetadata<NegotiateMetadata>());
Microsoft.AspNetCore.StaticAssets (1)
StaticAssetsInvoker.cs (1)
163if (context.GetEndpoint() is Endpoint { Metadata: { } metadata } && metadata.GetMetadata<BuildAssetMetadata>() != null)
MinimalSample (1)
Program.cs (1)
33tags ??= endpoint?.Metadata.GetMetadata<ITagsMetadata>()?.Tags ?? Array.Empty<string>();
RoutingWebSite (1)
UseEndpointRoutingStartup.cs (1)
71return httpContext.Response.WriteAsync((endpoint.Metadata.GetMetadata<CustomMetadata>() != null) ? "Has metadata" : "No metadata");
SignalR.Client.FunctionalTestApp (1)
Startup.cs (1)
74if (endpoint != null && endpoint.Metadata.GetMetadata<HubMetadata>() != null)
StaticFilesAuth (1)
Startup.cs (1)
49var directory = endpoint.Metadata.GetMetadata<DirectoryInfo>();