/// <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">Auto routing configuration</param> /// <returns><see cref="IApplicationBuilder"/> that includes the Basic auth middleware</returns> public static IApplicationBuilder UseJsonRpc(this IApplicationBuilder app, IRpcRouteProvider routeProvider) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (routeProvider == null) { throw new ArgumentNullException(nameof(routeProvider)); } if (app.ApplicationServices.GetService <RpcServicesMarker>() == null) { throw new InvalidOperationException("AddJsonRpc() needs to be called in the ConfigureServices method."); } var router = new RpcHttpRouter(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="methodProvider">All the available methods to call</param> /// <returns><see cref="IApplicationBuilder"/> that includes the Basic auth middleware</returns> internal static IApplicationBuilder UseJsonRpc(this IApplicationBuilder app, RpcRouteMetaData data) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (data == null) { throw new ArgumentNullException(nameof(data)); } if (app.ApplicationServices.GetService <RpcServicesMarker>() == null) { throw new InvalidOperationException("AddJsonRpc() needs to be called in the ConfigureServices method."); } var router = new RpcHttpRouter(); app.ApplicationServices.GetRequiredService <StaticRpcMethodDataAccessor>().Value = data; return(app.UseRouter(router)); }
public XFRpcHttpRouter() { _internalRouter = new RpcHttpRouter(new XFRpcRouteProvider()); }