6 writes to Metadata
Microsoft.AspNetCore.Mvc.Core (1)
Routing\ActionEndpointFactory.cs (1)
221Metadata =
Microsoft.AspNetCore.Routing.Tests (5)
RouteEndpointBuilderTest.cs (5)
37Metadata = { metadata } 59Metadata = { new TestRouteDiaganosticsMetadata { Route = "Test" }, metadata } 88Metadata = { new TestCorsMetadata(), new HttpMethodMetadata(new[] { HttpMethods.Delete }, acceptCorsPreflight: false) } 108Metadata = { new HttpMethodMetadata(new[] { HttpMethods.Get }, acceptCorsPreflight: false), new TestCorsMetadata(), new HttpMethodMetadata(new[] { HttpMethods.Delete }, acceptCorsPreflight: false) } 129Metadata = { new HttpMethodMetadata(new[] { HttpMethods.Delete }, acceptCorsPreflight: false) }
416 references to Metadata
Aspire.Dashboard (1)
Otlp\Http\OtlpHttpEndpointsBuilder.cs (1)
101.Add(b => b.Metadata.Add(new SkipStatusCodePagesAttribute()));
Microsoft.AspNetCore.Authorization.Policy (5)
AuthorizationEndpointConventionBuilderExtensions.cs (5)
129endpointBuilder.Metadata.Add(_allowAnonymousMetadata); 140if (!endpointBuilder.Metadata.Any(meta => meta is IAuthorizeData)) 142endpointBuilder.Metadata.Add(new AuthorizeAttribute()); 144endpointBuilder.Metadata.Add(policy); 155endpointBuilder.Metadata.Add(data);
Microsoft.AspNetCore.Authorization.Test (20)
AuthorizationEndpointConventionBuilderExtensionsTests.cs (20)
28Assert.Equal(metadata, Assert.Single(endpointModel.Metadata)); 46var authMetadata = Assert.IsAssignableFrom<IAuthorizeData>(Assert.Single(endpointModel.Metadata)); 65var authMetadata = Assert.IsAssignableFrom<IAuthorizeData>(Assert.Single(endpointModel.Metadata)); 84var authMetadata = Assert.IsAssignableFrom<IAuthorizeData>(Assert.Single(endpointModel.Metadata)); 103var authMetadata = Assert.IsAssignableFrom<IAuthorizeData>(Assert.Single(endpointModel.Metadata)); 136Assert.Equal(2, endpointModel.Metadata.Count); 137var authMetadata = Assert.IsAssignableFrom<IAuthorizeData>(endpointModel.Metadata[0]); 140Assert.Equal(policy, endpointModel.Metadata[1]); 159Assert.Equal(2, endpointModel.Metadata.Count); 160var authMetadata = Assert.IsAssignableFrom<IAuthorizeData>(endpointModel.Metadata[0]); 163var policy = Assert.IsAssignableFrom<AuthorizationPolicy>(endpointModel.Metadata[1]); 183endpointModel.Metadata.Add(authorize); 187Assert.Equal(2, endpointModel.Metadata.Count); 188Assert.Equal(authorize, endpointModel.Metadata[0]); 189var policy = Assert.IsAssignableFrom<AuthorizationPolicy>(endpointModel.Metadata[1]); 209endpointModel.Metadata.Add(authorize); 213Assert.Equal(2, endpointModel.Metadata.Count); 214Assert.Equal(authorize, endpointModel.Metadata[0]); 215Assert.Equal(policy, endpointModel.Metadata[1]); 235Assert.IsAssignableFrom<IAllowAnonymous>(Assert.Single(endpointModel.Metadata));
Microsoft.AspNetCore.Components.Endpoints (15)
Builder\OpaqueRedirection.cs (1)
61routeEndpointBuidler.Metadata.Add(new HttpMethodMetadata([HttpMethods.Get]));
Builder\RazorComponentEndpointFactory.cs (7)
39builder.Metadata.Add(new RequireAntiforgeryTokenAttribute()); 44builder.Metadata.Add(attribute); 48builder.Metadata.Add(new SuppressLinkGenerationMetadata()); 49builder.Metadata.Add(HttpMethodsMetadata); 50builder.Metadata.Add(new ComponentTypeMetadata(pageDefinition.Type)); 51builder.Metadata.Add(new RootComponentMetadata(rootComponent)); 52builder.Metadata.Add(configuredRenderModesMetadata);
Builder\RenderModeEndpointProvider.cs (2)
44builder.Metadata.Add(new RootComponentMetadata(rootComponent)); 45builder.Metadata.Add(renderMode);
Builder\ResourceCollectionConvention.cs (3)
51eb.Metadata.Add(_collection); 55eb.Metadata.Add(new ResourceCollectionUrlMetadata(_collectionUrl)); 60eb.Metadata.Add(importMap);
Builder\ResourceCollectionUrlEndpoint.cs (2)
264fingerprintedBuilderConeg.Metadata.Add(encodingMetadata); 281builderConeg.Metadata.Add(encodingMetadata);
Microsoft.AspNetCore.Components.Endpoints.Tests (6)
Builder\RazorComponentsEndpointConventionBuilderExtensionsTest.cs (1)
234rb.Metadata.Add(obj);
RazorComponentEndpointFactoryTest.cs (5)
60builder => builder.Metadata.Add(new AuthorizeAttribute()) 89builder => builder.Metadata.Add(new AuthorizeAttribute()) 144builder => builder.Metadata.Add(new AuthorizeAttribute()) 149builder => builder.Metadata.Remove(builder.Metadata.OfType<AuthorizeAttribute>().Single())
Microsoft.AspNetCore.Components.Server (5)
Builder\ServerRazorComponentsEndpointConventionBuilderExtensions.cs (2)
50for (var i = 0; i < b.Metadata.Count; i++) 52var metadata = b.Metadata[i];
DependencyInjection\ServerRazorComponentsBuilderExtensions.cs (3)
79for (var i = 0; i < c.Metadata.Count; i++) 81var metadata = c.Metadata[i]; 152builder.Metadata.Add(metadata);
Microsoft.AspNetCore.Components.Server.Tests (4)
ComponentEndpointRouteBuilderExtensionsTest.cs (4)
74if (builder.Metadata.Any(md => md is string smd && smd == "initial-md")) 109builder.Finally(b => b.Metadata.Add("first-in")); 110builder.Finally(b => b.Metadata.Add("last-in")); 113populatedMetadata = b.Metadata.OfType<string>().ToArray();
Microsoft.AspNetCore.Components.WebAssembly.Server (3)
Builder\WebAssemblyRazorComponentsEndpointConventionBuilderExtensions.cs (2)
38var needsCoopHeaders = endpointBuilder.Metadata.OfType<ComponentTypeMetadata>().Any() // e.g., /somecomponent 39|| endpointBuilder.Metadata.OfType<WebAssemblyRenderModeWithOptions>().Any(); // e.g., /_framework/*
WebAssemblyEndpointProvider.cs (1)
75builder.Metadata.Add(metadata);
Microsoft.AspNetCore.Cors (3)
Infrastructure\CorsEndpointConventionBuilderExtensions.cs (3)
25endpointBuilder.Metadata.Add(new EnableCorsAttribute()); 42endpointBuilder.Metadata.Add(new EnableCorsAttribute(policyName)); 64endpointBuilder.Metadata.Add(new CorsPolicyMetadata(policy));
Microsoft.AspNetCore.Cors.Test (1)
CorsEndpointConventionBuilderExtensionsTests.cs (1)
92return new Endpoint(RequestDelegate, new EndpointMetadataCollection(Metadata), DisplayName);
Microsoft.AspNetCore.Http (3)
Timeouts\RequestTimeoutsIEndpointConventionBuilderExtensions.cs (3)
37builder.Add(b => b.Metadata.Add(new RequestTimeoutAttribute(policyName))); 49builder.Add(b => b.Metadata.Add(policy)); 61builder.Add(b => b.Metadata.Add(_disableRequestTimeoutAttribute));
Microsoft.AspNetCore.Http.Abstractions (2)
Metadata\IEndpointMetadataProvider.cs (1)
21/// Add or remove objects on the <see cref="EndpointBuilder.Metadata"/> property of the <paramref name="builder"/> to modify the <see cref="Endpoint.Metadata"/> being built.
Metadata\IEndpointParameterMetadataProvider.cs (1)
21/// Add or remove objects on the <see cref="EndpointBuilder.Metadata"/> property of the <paramref name="builder"/> to modify the <see cref="Endpoint.Metadata"/> being built.
Microsoft.AspNetCore.Http.Connections (2)
ConnectionEndpointRouteBuilderExtensions.cs (2)
68e.Metadata.Add(item); 126e.Metadata.Add(data);
Microsoft.AspNetCore.Http.Extensions (7)
HttpMetricsEndpointConventionBuilderExtensions.cs (1)
23builder.Add(b => b.Metadata.Add(_disableHttpMetricsAttribute));
RequestDelegateFactory.cs (4)
299return new RequestDelegateResult(finalRequestDelegate, AsReadOnlyList(endpointBuilder.Metadata)); 1047builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(type: typeof(string), statusCode: 200, PlaintextContentType)); 1051builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(returnType, statusCode: 200, PlaintextContentType)); 1055builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(returnType, statusCode: 200, DefaultAcceptsAndProducesContentType));
RequestDelegateFactoryOptions.cs (2)
38/// This is primarily used to run <see cref="EndpointBuilder.FilterFactories"/> and populate inferred <see cref="EndpointBuilder.Metadata"/>. 43/// Any metadata already in <see cref="EndpointBuilder.Metadata"/> will be included in <see cref="RequestDelegateResult.EndpointMetadata" /> <b>before</b>
Microsoft.AspNetCore.Http.Extensions.Tests (53)
HttpMetricsEndpointConventionBuilderExtensionsTests.cs (1)
17Assert.IsAssignableFrom<IDisableHttpMetricsMetadata>(Assert.Single(builder.Metadata));
RequestDelegateFactoryTests.cs (28)
2888Assert.Same(options.EndpointBuilder.Metadata, result.EndpointMetadata); 3084Assert.Same(options.EndpointBuilder.Metadata, result.EndpointMetadata); 3297builder.Metadata.Add(metadataService); 3313builder.Metadata.Add(metadataService); 3330builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.ReturnType }); 3350var currentMetadataCount = builder.Metadata.Count; 3351builder.Metadata.Add(new MetadataCountMetadata { Count = currentMetadataCount }); 3361var currentMetadataCount = builder.Metadata.Count; 3362builder.Metadata.Add(new MetadataCountMetadata { Count = currentMetadataCount }); 3370if (builder.Metadata is not null) 3372for (int i = builder.Metadata.Count - 1; i >= 0; i--) 3374var metadata = builder.Metadata[i]; 3377builder.Metadata.RemoveAt(i); 3388if (builder.Metadata is not null) 3390for (int i = builder.Metadata.Count - 1; i >= 0; i--) 3392var metadata = builder.Metadata[i]; 3395builder.Metadata.RemoveAt(i); 3406if (builder.Metadata is not null) 3408for (int i = builder.Metadata.Count - 1; i >= 0; i--) 3410var metadata = builder.Metadata[i]; 3413builder.Metadata.RemoveAt(i); 3426builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 3431builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Property }); 3451builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 3456builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter }); 3474builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 3479builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter }); 3492builder.Metadata.Add(new RoutePatternMetadata { RoutePattern = reb.RoutePattern?.RawText ?? string.Empty });
RequestDelegateGenerator\SharedTypes.cs (24)
34builder.Metadata.Add(new CustomMetadata() 42builder.Metadata.Add(new CustomMetadata() 561builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 566builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter }); 596builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 601builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter }); 609builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 614builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Property }); 621builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.ReturnType }); 633builder.Metadata.Add(metadataService); 644if (builder.Metadata is not null) 646for (int i = builder.Metadata.Count - 1; i >= 0; i--) 648var metadata = builder.Metadata[i]; 651builder.Metadata.RemoveAt(i); 662if (builder.Metadata is not null) 664for (int i = builder.Metadata.Count - 1; i >= 0; i--) 666var metadata = builder.Metadata[i]; 669builder.Metadata.RemoveAt(i); 687builder.Metadata.Add(metadataService); 927var currentMetadataCount = builder.Metadata.Count; 928builder.Metadata.Add(new MetadataCountMetadata { Count = currentMetadataCount }); 952builder.Metadata.Add(new RoutePatternMetadata { RoutePattern = reb.RoutePattern?.RawText ?? string.Empty }); 960var currentMetadataCount = builder.Metadata.Count; 961builder.Metadata.Add(new MetadataCountMetadata { Count = currentMetadataCount });
Microsoft.AspNetCore.Http.Microbenchmarks (24)
src\Http\Http.Extensions\test\RequestDelegateGenerator\SharedTypes.cs (24)
34builder.Metadata.Add(new CustomMetadata() 42builder.Metadata.Add(new CustomMetadata() 561builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 566builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter }); 596builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 601builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter }); 609builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 614builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Property }); 621builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.ReturnType }); 633builder.Metadata.Add(metadataService); 644if (builder.Metadata is not null) 646for (int i = builder.Metadata.Count - 1; i >= 0; i--) 648var metadata = builder.Metadata[i]; 651builder.Metadata.RemoveAt(i); 662if (builder.Metadata is not null) 664for (int i = builder.Metadata.Count - 1; i >= 0; i--) 666var metadata = builder.Metadata[i]; 669builder.Metadata.RemoveAt(i); 687builder.Metadata.Add(metadataService); 927var currentMetadataCount = builder.Metadata.Count; 928builder.Metadata.Add(new MetadataCountMetadata { Count = currentMetadataCount }); 952builder.Metadata.Add(new RoutePatternMetadata { RoutePattern = reb.RoutePattern?.RawText ?? string.Empty }); 960var currentMetadataCount = builder.Metadata.Count; 961builder.Metadata.Add(new MetadataCountMetadata { Count = currentMetadataCount });
Microsoft.AspNetCore.Http.Results (22)
Accepted.cs (1)
84builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status202Accepted, typeof(void)));
AcceptedAtRoute.cs (1)
111builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status202Accepted, typeof(void)));
AcceptedAtRouteOfT.cs (1)
125builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status202Accepted, ContentTypeConstants.ApplicationJsonContentTypes));
AcceptedOfT.cs (1)
103builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status202Accepted, ContentTypeConstants.ApplicationJsonContentTypes));
BadRequest.cs (1)
54builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status400BadRequest, typeof(void)));
BadRequestOfT.cs (1)
68builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status400BadRequest, ContentTypeConstants.ApplicationJsonContentTypes));
Conflict.cs (1)
54builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status409Conflict, typeof(void)));
ConflictOfT.cs (1)
68builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status409Conflict, ContentTypeConstants.ApplicationJsonContentTypes));
Created.cs (1)
84builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status201Created, typeof(void)));
CreatedAtRoute.cs (1)
111builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status201Created, typeof(void)));
CreatedAtRouteOfT.cs (1)
128builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status201Created, ContentTypeConstants.ApplicationJsonContentTypes));
CreatedOfT.cs (1)
102builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status201Created, ContentTypeConstants.ApplicationJsonContentTypes));
InternalServerError.cs (1)
54builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status500InternalServerError, typeof(void)));
InternalServerErrorOfT.cs (1)
68builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status500InternalServerError, ContentTypeConstants.ApplicationJsonContentTypes));
NoContent.cs (1)
54builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status204NoContent, typeof(void)));
NotFound.cs (1)
53builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status404NotFound, typeof(void)));
NotFoundOfT.cs (1)
67builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status404NotFound, ContentTypeConstants.ApplicationJsonContentTypes));
Ok.cs (1)
53builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status200OK, typeof(void)));
OkOfT.cs (1)
67builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status200OK, ContentTypeConstants.ApplicationJsonContentTypes));
UnprocessableEntity.cs (1)
54builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status422UnprocessableEntity, typeof(void)));
UnprocessableEntityOfT.cs (1)
68builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(TValue), StatusCodes.Status422UnprocessableEntity, ContentTypeConstants.ApplicationJsonContentTypes));
ValidationProblem.cs (1)
79builder.Metadata.Add(ProducesResponseTypeMetadata.CreateUnvalidated(typeof(HttpValidationProblemDetails), StatusCodes.Status400BadRequest, ContentTypeConstants.ProblemDetailsContentTypes));
Microsoft.AspNetCore.Http.Results.Tests (54)
AcceptedAtRouteOfTResultTests.cs (1)
133var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
AcceptedAtRouteResultTests.cs (1)
87var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
AcceptedOfTResultTests.cs (1)
74var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
AcceptedResultTests.cs (1)
44var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
BadRequestOfTResultTests.cs (1)
117var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
BadRequestResultTests.cs (1)
57var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
ConflictOfTResultTests.cs (1)
95var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
ConflictResultTests.cs (1)
58var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedAtRouteOfTResultTests.cs (1)
103var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedAtRouteResultTests.cs (1)
85var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedOfTResultTests.cs (1)
109var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedResultTests.cs (1)
75var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
InternalServerErrorOfTResultTests.cs (1)
117var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
InternalServerErrorResultTests.cs (1)
57var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
NoContentResultTests.cs (1)
54var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
NotFoundOfTResultTests.cs (1)
77var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
NotFoundResultTests.cs (1)
53var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
OkOfTResultTests.cs (1)
94var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
OkResultTests.cs (1)
56var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
ResultsOfTHelperTests.cs (5)
88return endpointBuilder.Metadata; 103builder.Metadata.Add("Called"); 111builder.Metadata.Add("Called"); 124builder.Metadata.Add("Called"); 132builder.Metadata.Add("Called");
ResultsOfTTests.Generated.cs (27)
215Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult1) }); 216Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult2) }); 494Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult1) }); 495Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult2) }); 496Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult3) }); 850Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult1) }); 851Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult2) }); 852Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult3) }); 853Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult4) }); 1291Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult1) }); 1292Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult2) }); 1293Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult3) }); 1294Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult4) }); 1295Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult5) }); 1825Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult1) }); 1826Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult2) }); 1827Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult3) }); 1828Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult4) }); 1829Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult5) }); 1830Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata { SourceTypeName: nameof(ProvidesMetadataResult6) }); 1867builder.Metadata.Add(new ResultTypeProvidedMetadata { SourceTypeName = nameof(ProvidesMetadataResult1) }); 1881builder.Metadata.Add(new ResultTypeProvidedMetadata { SourceTypeName = nameof(ProvidesMetadataResult2) }); 1895builder.Metadata.Add(new ResultTypeProvidedMetadata { SourceTypeName = nameof(ProvidesMetadataResult3) }); 1909builder.Metadata.Add(new ResultTypeProvidedMetadata { SourceTypeName = nameof(ProvidesMetadataResult4) }); 1923builder.Metadata.Add(new ResultTypeProvidedMetadata { SourceTypeName = nameof(ProvidesMetadataResult5) }); 1937builder.Metadata.Add(new ResultTypeProvidedMetadata { SourceTypeName = nameof(ProvidesMetadataResult6) }); 1950builder.Metadata.Add(new ResultTypeProvidedMetadata { SourceTypeName = nameof(ProvidesMetadataResult7) });
UnprocessableEntityOfTResultTests.cs (1)
94var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
UnprocessableEntityResultTests.cs (1)
57var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
ValidationProblemResultTests.cs (1)
105var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
Microsoft.AspNetCore.HttpLogging (1)
HttpLoggingEndpointConventionBuilderExtensions.cs (1)
41endpointBuilder.Metadata.Add(metadata);
Microsoft.AspNetCore.HttpLogging.Tests (1)
HttpLoggingEndpointConventionBuilderTests.cs (1)
58return new Endpoint(RequestDelegate, new EndpointMetadataCollection(Metadata), DisplayName);
Microsoft.AspNetCore.Identity (1)
IdentityApiEndpointRouteBuilderExtensions.cs (1)
190endpointBuilder.Metadata.Add(new EndpointNameMetadata(confirmEmailEndpointName));
Microsoft.AspNetCore.Mvc.Core (28)
Builder\ControllerEndpointRouteBuilderExtensions.cs (8)
216b.Metadata.Add(CreateDynamicControllerMetadata(action, controller, area: null)); 217b.Metadata.Add(new ControllerEndpointDataSourceIdMetadata(dataSource.DataSourceId)); 280b.Metadata.Add(CreateDynamicControllerMetadata(action, controller, area: null)); 281b.Metadata.Add(new ControllerEndpointDataSourceIdMetadata(dataSource.DataSourceId)); 340b.Metadata.Add(CreateDynamicControllerMetadata(action, controller, area)); 341b.Metadata.Add(new ControllerEndpointDataSourceIdMetadata(dataSource.DataSourceId)); 406b.Metadata.Add(CreateDynamicControllerMetadata(action, controller, area)); 407b.Metadata.Add(new ControllerEndpointDataSourceIdMetadata(dataSource.DataSourceId));
Routing\ActionEndpointFactory.cs (18)
230builder.Metadata.Add(new RouteNameMetadata(route.RouteName)); 240builder.Metadata.Add(new EndpointNameMetadata(route.RouteName)); 366builder.Metadata.Add(d); 370builder.Metadata.Add(action); 388builder.Metadata.OfType<IEndpointNameMetadata>().LastOrDefault()?.EndpointName == null) 390builder.Metadata.Add(new EndpointNameMetadata(routeName)); 395builder.Metadata.Add(new DataTokensMetadata(dataTokens)); 398builder.Metadata.Add(new RouteNameMetadata(routeName)); 405builder.Metadata.Add(filter); 419!builder.Metadata.OfType<HttpMethodMetadata>().Any()) 421builder.Metadata.Add(new HttpMethodMetadata(httpMethodActionConstraint.HttpMethods)); 424!builder.Metadata.OfType<AcceptsMetadata>().Any()) 426builder.Metadata.Add(new AcceptsMetadata(consumesAttribute.ContentTypes.ToArray())); 428else if (!builder.Metadata.Contains(actionConstraint)) 431builder.Metadata.Add(actionConstraint); 438builder.Metadata.Add(new SuppressLinkGenerationMetadata()); 443builder.Metadata.Add(new SuppressMatchingMetadata()); 551return new Endpoint(RequestDelegate, new EndpointMetadataCollection(Metadata), DisplayName);
Routing\ControllerActionEndpointDataSource.cs (2)
150b.Metadata.Add(new DynamicControllerRouteValueTransformerMetadata(transformerType, state)); 151b.Metadata.Add(new ControllerEndpointDataSourceIdMetadata(DataSourceId));
Microsoft.AspNetCore.Mvc.Core.Test (35)
ApplicationModels\EndpointMetadataProviderTest.cs (25)
107builder => builder.Metadata.Add(new CustomEndpointMetadata() { Source = MetadataSource.Caller }), 111builder => builder.Metadata.Add(new CustomEndpointMetadata() { Source = MetadataSource.Finally }), 150builder => builder.Metadata.Add(new ConsumesAttribute("application/json")), 171builder => builder.Metadata.Add(new ConsumesAttribute("application/json")), 192builder => builder.Metadata.Add(new ConsumesAttribute("application/json")), 396builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name }); 401builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter }); 409builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.ReturnType }); 419builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.ReturnType }); 433builder.Metadata.Add(new RoutePatternMetadata { RoutePattern = reb.RoutePattern.RawText }); 441for (int i = builder.Metadata.Count - 1; i >= 0; i--) 443var metadata = builder.Metadata[i]; 446builder.Metadata.RemoveAt(i); 458if (builder.Metadata is not null) 460for (int i = builder.Metadata.Count - 1; i >= 0; i--) 462var metadata = builder.Metadata[i]; 465builder.Metadata.RemoveAt(i); 478if (builder.Metadata is not null) 480for (int i = builder.Metadata.Count - 1; i >= 0; i--) 482var metadata = builder.Metadata[i]; 485builder.Metadata.RemoveAt(i); 496if (builder.Metadata is not null) 498for (int i = builder.Metadata.Count - 1; i >= 0; i--) 500var metadata = builder.Metadata[i]; 503builder.Metadata.RemoveAt(i);
Routing\ControllerActionEndpointDataSourceTest.cs (10)
329dataSource.AddRoute("1", "/1/{controller}/{action}/{id?}", null, null, null).Add(b => b.Metadata.Add("A")); 330dataSource.AddRoute("2", "/2/{controller}/{action}/{id?}", null, null, null).Add(b => b.Metadata.Add("B")); 411dataSource.AddRoute("1", "/1/{controller}/{action}/{id?}", null, null, null).Add(b => b.Metadata.Add("A")); 412dataSource.AddRoute("2", "/2/{controller}/{action}/{id?}", null, null, null).Add(b => b.Metadata.Add("B")); 422b => b.Metadata.Add(new GroupMetadata()), 423b => b.Metadata.Add("group") 512builder1.Finally(b => b.Metadata.Add("A1")); 513builder1.Finally(b => b.Metadata.Add("A2")); 515builder2.Finally(b => b.Metadata.Add("B1")); 516builder2.Finally(b => b.Metadata.Add("B2"));
Microsoft.AspNetCore.Mvc.RazorPages (13)
Builder\PageActionEndpointConventionBuilderResourceCollectionExtensions.cs (2)
45endpointBuilder.Metadata.Add(collection); 46endpointBuilder.Metadata.Add(importMap);
Builder\RazorPagesEndpointRouteBuilderExtensions.cs (8)
85b.Metadata.Add(CreateDynamicPageMetadata(page, area: null)); 86b.Metadata.Add(new PageEndpointDataSourceIdMetadata(pageDataSource.DataSourceId)); 143b.Metadata.Add(CreateDynamicPageMetadata(page, area: null)); 144b.Metadata.Add(new PageEndpointDataSourceIdMetadata(pageDataSource.DataSourceId)); 197b.Metadata.Add(CreateDynamicPageMetadata(page, area)); 198b.Metadata.Add(new PageEndpointDataSourceIdMetadata(pageDataSource.DataSourceId)); 257b.Metadata.Add(CreateDynamicPageMetadata(page, area)); 258b.Metadata.Add(new PageEndpointDataSourceIdMetadata(pageDataSource.DataSourceId));
Infrastructure\DefaultPageLoader.cs (1)
83b.Metadata.Insert(0, endpointMetadata[i]);
Infrastructure\PageActionEndpointDataSource.cs (2)
90b.Metadata.Add(new DynamicPageRouteValueTransformerMetadata(transformerType, state)); 91b.Metadata.Add(new PageEndpointDataSourceIdMetadata(DataSourceId));
Microsoft.AspNetCore.Mvc.RazorPages.Test (2)
Infrastructure\PageActionEndpointDataSourceTest.cs (2)
140b => b.Metadata.Add(new GroupMetadata()), 141b => b.Metadata.Add("group")
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
Builder\ControllerActionEndpointConventionBuilderResourceCollectionExtensions.cs (3)
45if (endpointBuilder.Metadata.OfType<ApiControllerAttribute>().Any()) 53endpointBuilder.Metadata.Add(collection); 54endpointBuilder.Metadata.Add(importMap);
Microsoft.AspNetCore.OpenApi (5)
Extensions\OpenApiEndpointConventionBuilderExtensions.cs (5)
65foreach (var item in endpointBuilder.Metadata) 75endpointBuilder.Metadata.Remove(existingOperation); 81endpointBuilder.Metadata.Add(configuredOperation); 97var metadata = new EndpointMetadataCollection(routeEndpointBuilder.Metadata); 120routeEndpointBuilder.Metadata.Add(newOperation);
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiGeneratorTests.cs (1)
65var operation = GetOpenApiOperation(() => { }, additionalMetadata: testBuilder.Metadata.ToArray());
Microsoft.AspNetCore.OutputCaching (4)
Policies\OutputCacheConventionBuilderExtensions.cs (4)
25endpointBuilder.Metadata.Add(DefaultPolicy.Instance); 41endpointBuilder.Metadata.Add(policy); 71endpointBuilder.Metadata.Add(outputCachePolicyBuilder.Build()); 88endpointBuilder.Metadata.Add(policy);
Microsoft.AspNetCore.RateLimiting (3)
RateLimiterEndpointConventionBuilderExtensions.cs (3)
26endpointBuilder.Metadata.Add(new EnableRateLimitingAttribute(policyName)); 45endpointBuilder.Metadata.Add(new EnableRateLimitingAttribute(new DefaultRateLimiterPolicy(RateLimiterOptions.ConvertPartitioner<TPartitionKey>(null, policy.GetPartition), policy.OnRejected))); 62endpointBuilder.Metadata.Add(DisableRateLimitingAttribute.Instance);
Microsoft.AspNetCore.RateLimiting.Tests (3)
RateLimitingMetricsTests.cs (2)
197routeEndpointBuilder.Metadata.Add(new EnableRateLimitingAttribute("concurrencyPolicy")); 272routeEndpointBuilder.Metadata.Add(new EnableRateLimitingAttribute("concurrencyPolicy"));
TestEndpointBuilder.cs (1)
18return new Endpoint(RequestDelegate, new EndpointMetadataCollection(Metadata), DisplayName);
Microsoft.AspNetCore.Routing (29)
Builder\EndpointRouteBuilderExtensions.cs (2)
213IReadOnlyList<object> metadata = options.EndpointBuilder?.Metadata is not null ? 214new List<object>(options.EndpointBuilder.Metadata) :
Builder\OpenApiRouteHandlerBuilderExtensions.cs (16)
20/// Adds the <see cref="IExcludeFromDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 29/// Adds the <see cref="IExcludeFromDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 38/// Adds an <see cref="IProducesResponseTypeMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 59/// Adds an <see cref="IProducesResponseTypeMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 96/// to <see cref="EndpointBuilder.Metadata"/> for all endpoints produced by <paramref name="builder"/>. 114/// to <see cref="EndpointBuilder.Metadata"/> for all endpoints produced by <paramref name="builder"/>. 135/// to <see cref="EndpointBuilder.Metadata"/> for all endpoints produced by <paramref name="builder"/>. 156/// to <see cref="EndpointBuilder.Metadata"/> for all endpoints produced by <paramref name="builder"/>. 179/// Adds the <see cref="ITagsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 194/// Adds the <see cref="ITagsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 209/// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 226/// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 245/// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 263/// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 284/// Adds <see cref="IEndpointDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints 294/// Adds <see cref="IEndpointSummaryMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
Builder\RoutingEndpointConventionBuilderExtensions.cs (4)
32endpointBuilder.Metadata.Add(new HostAttribute(hosts)); 77/// Adds the provided metadata <paramref name="items"/> to <see cref="EndpointBuilder.Metadata"/> for all builders 92b.Metadata.Add(item); 162builder.Finally(builder => builder.Metadata.Add(AntiforgeryMetadata.ValidationNotRequired));
EndpointDataSource.cs (1)
71routeEndpointBuilder.Metadata.Add(metadata);
RouteEndpointBuilder.cs (1)
59CreateMetadataCollection(Metadata, RoutePattern),
RouteEndpointDataSource.cs (4)
182builder.Metadata.Add(FallbackMetadata.Instance); 187builder.Metadata.Add(methodInfo); 192builder.Metadata.Add(new HttpMethodMetadata(entry.HttpMethods)); 225builder.Metadata.Add(attribute);
ShortCircuit\RouteShortCircuitEndpointConventionBuilderExtensions.cs (1)
36builder.Add(b => b.Metadata.Add(metadata));
Microsoft.AspNetCore.Routing.Tests (47)
Builder\OpenApiRouteHandlerBuilderExtensionsTest.cs (9)
20=> Assert.IsType<ExcludeFromDescriptionAttribute>(Assert.Single(builder.Metadata)); 33var tags = Assert.IsType<TagsAttribute>(Assert.Single(builder.Metadata)); 51var metadata = Assert.IsType<ProducesResponseTypeMetadata>(Assert.Single(testBuilder.Metadata)); 65var metadata = Assert.IsType<ProducesResponseTypeMetadata>(Assert.Single(testBuilder.Metadata)); 79var metadata = Assert.IsType<ProducesResponseTypeMetadata>(Assert.Single(builder.Metadata)); 97var metadata = Assert.IsType<ProducesResponseTypeMetadata>(Assert.Single(builder.Metadata)); 114var metadata = Assert.IsType<AcceptsMetadata>(Assert.Single(testBuilder.Metadata)); 127var metadata = Assert.IsType<EndpointDescriptionAttribute>(Assert.Single(builder.Metadata)); 137var metadata = Assert.IsType<EndpointSummaryAttribute>(Assert.Single(builder.Metadata));
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (7)
377Assert.Equal(2, endpointBuilder1.Metadata.Count); 378Assert.IsType<Attribute1>(endpointBuilder1.Metadata[0]); 379Assert.IsType<Attribute2>(endpointBuilder1.Metadata[1]); 470Assert.Throws<InvalidOperationException>(() => endpointBuilder.Finally(b => b.Metadata.Add(new RouteNameMetadata("Foo")))); 555builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.ReturnType }); 567builder.Metadata.Add(new ParameterNameMetadata { Name = parameter.Name ?? string.Empty }); 572builder.Metadata.Add(new CustomEndpointMetadata { Source = MetadataSource.Parameter });
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (12)
500Assert.Throws<InvalidOperationException>(() => endpointBuilder.Finally(b => b.Metadata.Add(new RouteNameMetadata("Foo")))); 768Assert.Contains(FallbackMetadata.Instance, routeEndpointBuilder.Metadata); 1021if (b.Metadata.Any(md => md is string smd && smd == "added-from-endpoint")) 1023b.Metadata.Add("added-from-group"); 1027group.MapGet("/endpoint", () => { }).Finally(b => b.Metadata.Add("added-from-endpoint")); 1045if (b.Metadata.Any(md => md is string smd && smd == "added-from-endpoint-1") 1046&& b.Metadata.Any(md => md is string smd && smd == "added-from-endpoint-2")) 1048b.Metadata.Add("added-from-inner-group"); 1053if (b.Metadata.Any(md => md is string smd && smd == "added-from-inner-group")) 1055b.Metadata.Add("added-from-outer-group"); 1060handler.Finally(b => b.Metadata.Add("added-from-endpoint-1")); 1061handler.Finally(b => b.Metadata.Add("added-from-endpoint-2"));
Builder\RoutingEndpointConventionBuilderExtensionsTest.cs (7)
27var hostMetadata = Assert.IsType<HostAttribute>(Assert.Single(endpointModel.Metadata)); 182if (inner.Metadata.Any(md => md is string smd && smd == "test-metadata")) 184inner.Metadata.Add("found-previous-metadata"); 206if (inner.Metadata.Any(md => md is string smd && smd == "test-metadata")) 208inner.Metadata.Add("inner-metadata"); 213if (inner.Metadata.Any(md => md is string smd && smd == "inner-metadata")) 215inner.Metadata.Add("inner-metadata-2");
CompositeEndpointDataSourceTest.cs (10)
293b => b.Metadata.Add(metadata), 335if (b.Metadata.OfType<string>().SingleOrDefault() == "initial-metadata") 337b.Metadata.Add(metadata); 385b => b.Metadata.Add("initial-metadata") 391if (b.Metadata.OfType<string>().SingleOrDefault() == "initial-metadata") 393b.Metadata.Add(metadata); 446if (b.Metadata.OfType<string>().SingleOrDefault() == "initial-metadata") 448b.Metadata.Add(metadata); 453if (b.Metadata.OfType<IEndpointNameMetadata>().SingleOrDefault() is not null) 455b.Metadata.Add("saw-last-metadata");
Matching\CandidateSetTest.cs (1)
375builder.Metadata.Add(metadata[i]);
RoutingMetricsTests.cs (1)
60routeEndpointBuilder.Metadata.Add(FallbackMetadata.Instance);
Microsoft.AspNetCore.SignalR (2)
HubEndpointRouteBuilderExtensions.cs (2)
64e.Metadata.Add(item); 68e.Metadata.Add(new HubMetadata(typeof(THub)));
Microsoft.AspNetCore.StaticAssets (6)
Development\StaticAssetDevelopmentRuntimeHandler.cs (2)
32var asset = builder.Metadata.OfType<StaticAssetDescriptor>().Single(); 240fallback.Add(b => b.Metadata.Add(new HttpMethodMetadata(["GET", "HEAD"])));
StaticAssetEndpointDataSource.cs (1)
43_conventions.Add(c => c.Metadata.Add(new BuildAssetMetadata()));
StaticAssetEndpointFactory.cs (3)
34routeEndpointBuilder.Metadata.Add(new ContentEncodingMetadata(selector.Value, double.Parse(selector.Quality, CultureInfo.InvariantCulture))); 47routeEndpointBuilder.Metadata.Add(resource); 48routeEndpointBuilder.Metadata.Add(_supportedMethods);
RoutingWebSite (2)
UseEndpointRoutingStartup.cs (2)
74b.Metadata.Add(new CustomMetadata()); 149endpointBuilder.Metadata.Add(new HostAttribute(hosts));