Exemplo n.º 1
0
 /// <inheritdoc cref="IEndpointResult.ExecuteResultAsync"/>
 public ValueTask ExecuteResultAsync(HttpContext context, EndpointOptions options)
 {
     return(ValueTask.CompletedTask);
 }
Exemplo n.º 2
0
 /// <inheritdoc cref="IEndpointResult.ExecuteResultAsync"/>
 public ValueTask ExecuteResultAsync(HttpContext context, EndpointOptions options)
 {
     context.Response.StatusCode = StatusCode;
     return(ValueTask.CompletedTask);
 }
Exemplo n.º 3
0
 public override ValueTask <ParameterBindingResult> Factory(HttpContext httpContext, EndpointOptions options, IBindingErrorCollection bindingErrorCollection)
 {
     return(options.JsonSerializer.DeserializeFromRequest(httpContext.Request, descriptor.ParameterType, bindingErrorCollection, httpContext.RequestAborted));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructs new EndpointOptionBuilders
 /// </summary>
 public EndpointOptionBuilders()
 {
     option = new EndpointOptions();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Factory for building parameter from HttpContext
 /// </summary>
 public abstract ValueTask <ParameterBindingResult> Factory(HttpContext httpContext, EndpointOptions options, IBindingErrorCollection bindingErrorCollection);
        private static EasyEndpointBuilder AddEmptyEasyEndpoints(this IServiceCollection services, EndpointOptions options)
        {
            services.AddTransient(ManifestHelper.BuidManifest);
            services.AddSingleton(options);
            services.AddTransient <IEasyEndpointCompositeMetadataDetailsProvider, EasyEndpointCompositeMetadataDetailsProvider>();
            services.AddTransient <IApiDescriptionGroupCollectionProvider, EasyEndpointApiDescriptionGroupCollectionProvider>();
            var builderOptions = new EasyEndpointBuilderOptions();

            services.AddSingleton(builderOptions);

            services.AddTransient <IMalformedRequestExceptionHandler, DefaultIMalformedRequestExceptionHandler>();
            var builder = new EasyEndpointBuilder(services, builderOptions, options);

            AddDefaultParsers(builder);
            return(builder);
        }
Exemplo n.º 7
0
 internal EasyEndpointBuilder(IServiceCollection serviceCollection, EasyEndpointBuilderOptions builderOptions, EndpointOptions endpointOptions)
 {
     this.serviceCollection = serviceCollection;
     this.endpointOptions   = endpointOptions;
     this.builderOptions    = builderOptions;
 }
Exemplo n.º 8
0
 /// <inheritdoc />
 public async ValueTask ExecuteResultAsync(HttpContext context, EndpointOptions options)
 {
     context.Response.StatusCode = StatusCode;
     await options.JsonSerializer.SerializeToResponse(context.Response, Result, context.RequestAborted);
 }