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 IContentPageServiceComponent UseInMemoryBackend( this IContentPageServiceComponent serviceComponent, IDependencyInjectionRootComponent rootComponent, Action <IInMemoryContentPageServiceBackendComponent> componentConfig = null) { var component = new InMemoryContentPageServiceBackendComponent(); // Invoke config delegate componentConfig?.Invoke(component); // Attach to root component rootComponent.AttachComponent(component); // Override command handlers serviceComponent .OverridePersistContentPageCommandHandler <PersistContentPageCommandHandler>() .OverrideDeleteContentPageCommandHandler <DeleteContentPageCommandHandler>(); // Override query handlers serviceComponent .OverrideCheckContentPageServiceHealthQueryHandler <CheckContentPageServiceHealthQueryHandler>() .OverrideFetchContentPagesByHandlesQueryHandler <FetchContentPagesByHandlesQueryHandler>() .OverrideFetchContentPagesByIdsQueryHandler <FetchContentPagesByIdsQueryHandler>() .OverrideFetchContentPagesBySearchQueryHandler <FetchContentPagesBySearchQueryHandler>(); return(serviceComponent); }
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); }