public static INavigationServiceComponent UseInMemoryBackend( this INavigationServiceComponent serviceComponent, IDependencyInjectionRootComponent rootComponent, Action <IInMemoryNavigationServiceBackendComponent> componentConfig = null) { var component = new InMemoryNavigationServiceBackendComponent(); // Invoke config delegate componentConfig?.Invoke(component); // Attach to root component rootComponent.AttachComponent(component); // Override command handlers serviceComponent .OverridePersistNavigationCommandHandler <PersistNavigationCommandHandler>() .OverrideDeleteNavigationCommandHandler <DeleteNavigationCommandHandler>(); // Override query handlers serviceComponent .OverrideCheckNavigationServiceHealthQueryHandler <CheckNavigationServiceHealthQueryHandler>() .OverrideFetchNavigationsByHandlesQueryHandler <FetchNavigationsByHandlesQueryHandler>() .OverrideFetchNavigationsByIdsQueryHandler <FetchNavigationsByIdsQueryHandler>(); return(serviceComponent); }
public static IDependencyInjectionRootComponent AddStorefrontGateway(this IDependencyInjectionRootComponent rootComponent, IServiceCollection serviceCollection, Action <IStorefrontGatewayComponent> componentConfig = null) { var component = new StorefrontGatewayComponent(); // Invoke config delegate componentConfig?.Invoke(component); // Attach to root component rootComponent.AttachComponent(component); // Add and configure GraphQL serviceCollection.AddGraphQL((options, provider) => { var logger = provider.GetRequiredService <ILogger <StorefrontGraphSchema> >(); options.UnhandledExceptionDelegate = ctx => logger.LogError("{Error} occured", ctx.Exception, ctx.OriginalException.Message); // Pass call to configurator for custom configuration, if configured component.ConfigureGraphQLDelegate?.Invoke(options, provider); }) .AddDataLoader() .AddUserContextBuilder <StorefrontGraphUserContextBuilder>() .AddSystemTextJson(deserializerSettings => { }, serializerSettings => { }); return(rootComponent); }
public static IDependencyInjectionRootComponent AddMetaFieldService(this IDependencyInjectionRootComponent rootComponent, Action <IMetaFieldServiceComponent> componentConfig = null) { var component = new MetaFieldServiceComponent(); // Invoke config delegate componentConfig?.Invoke(component); // Attach to root component rootComponent.AttachComponent(component); return(rootComponent); }