/// <summary> /// Extension method to use the JsonRpc router in the Asp.Net pipeline /// </summary> /// <param name="app"><see cref="IApplicationBuilder"/> that is supplied by Asp.Net</param> /// <param name="configureOptions">Optional action to configure manual routing</param> /// <returns><see cref="IApplicationBuilder"/> that includes the Basic auth middleware</returns> public static IApplicationBuilder UseManualJsonRpc(this IApplicationBuilder app, Action <RpcManualRoutingOptions> configureOptions = null) { if (app == null) { throw new ArgumentNullException(nameof(app)); } var options = new RpcManualRoutingOptions(); configureOptions?.Invoke(options); IRpcRouteProvider routeProvider = new RpcManualRouteProvider(Options.Create(options)); return(app.UseJsonRpc(routeProvider)); }
/// <summary> /// Extension method to use the JsonRpc router in the Asp.Net pipeline /// </summary> /// <param name="app"><see cref="IApplicationBuilder"/> that is supplied by Asp.Net</param> /// <param name="configureOptions">Action to configure manual route provider options</param> /// <returns><see cref="IApplicationBuilder"/> that includes the Basic auth middleware</returns> public static IApplicationBuilder UseManualJsonRpc(this IApplicationBuilder app, Action <RpcManualRoutingOptions> configureOptions) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (configureOptions == null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new RpcManualRoutingOptions(); configureOptions(options); IRpcRouteProvider routeProvider = new RpcManualRouteProvider(options); RpcRouter router = ActivatorUtilities.CreateInstance <RpcRouter>(app.ApplicationServices, routeProvider); return(app.UseRouter(router)); }
/// <summary> /// Extension method to use the JsonRpc router in the Asp.Net pipeline /// </summary> /// <param name="app"><see cref="IApplicationBuilder"/> that is supplied by Asp.Net</param> /// <param name="options">Manual routing configuration</param> /// <returns><see cref="IApplicationBuilder"/> that includes the Basic auth middleware</returns> public static IApplicationBuilder UseManualJsonRpc(this IApplicationBuilder app, RpcManualRoutingOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } IRpcRouteProvider routeProvider = new RpcManualRouteProvider(Options.Create(options)); return(app.UseJsonRpc(routeProvider)); }
public RpcManualRouteProvider(RpcManualRoutingOptions options) { this.Options = options ?? throw new ArgumentNullException(nameof(options)); }