public static ConfigureWebApp EncryptionServices(this ConfigureWebApp configure) { return(configure.Services((context, services) => { //services.AddHostedService(er => new EncryptionReader(new DataProtection())); })); }
/// <summary> /// Adds the <see cref="BlazorUI.Client"/> services for the web assembly UI to perform automatic two-way binding. /// </summary> /// <param name="configure">An instance of a <see cref="ConfigureWebApp"/> from Totem.</param> /// <param name="queryMap">A list of <see cref="TimelineRoute"/> which maps a Query type to its <see cref="HttpMethodAttribute"/> route.</param> /// <returns></returns> public static ConfigureWebApp ClientUIServices(this ConfigureWebApp configure, List <TimelineRoute> queryMap) { return(configure.Services((context, services) => { services.AddServerSideBlazor(); services.AddSignalR().AddQueryNotifications(); services.AddTransient <HubConnectionBuilder>(); services.AddTransient <QueryController>(); services.AddSingleton <IRouteContext, RouteContext>(sp => new RouteContext(queryMap)); // Cannot seem to do this type of injection in client-side WASM right now... //services.AddTransient<IRouteContextFactory, RouteContextFactory>(sp => new RouteContextFactory(() => sp.GetService<IRouteContext>())); services.AddScoped <AppState>(state => new AppState( state.GetRequiredService <QueryController>(), state.GetRequiredService <HttpClient>())); services.AddHostedService(er => new EncryptionReader(new DataProtection())); })); }