public static IServiceCollection AddXCatalog(this IServiceCollection services, IGraphQLBuilder graphQlbuilder)
        {
            services.AddSchemaBuilder <DigitalCatalogSchema>();

            graphQlbuilder.AddGraphTypes(typeof(XDigitalCatalogAnchor));

            services.AddMediatR(typeof(XDigitalCatalogAnchor));
            //the generic pipeline that is used  for on-the-fly additional data evaluation (prices, inventories, discounts and taxes) for resulting products
            services.AddPipeline <SearchProductResponse>(builder =>
            {
                builder.AddMiddleware(typeof(EnsureCatalogProductLoadedMiddleware));
                builder.AddMiddleware(typeof(EvalProductsPricesMiddleware));
                builder.AddMiddleware(typeof(EvalProductsDiscountsMiddleware));
                builder.AddMiddleware(typeof(EvalProductsTaxMiddleware));
                builder.AddMiddleware(typeof(EvalProductsInventoryMiddleware));
            });

            services.AddPipeline <SearchCategoryResponse>(builder =>
            {
                builder.AddMiddleware(typeof(EnsureCategoryLoadedMiddleware));
            });

            services.AddAutoMapper(typeof(XDigitalCatalogAnchor));

            return(services);
        }
        public static IServiceCollection AddXPurchase(this IServiceCollection services, IGraphQLBuilder graphQlbuilder)
        {
            //TODO:
            //services.AddSchemaType<PaymentPlanType>();
            //services.AddSchemaType<SettingType>();
            //services.AddSchemaType<StoreStatusEnum>();
            //services.AddSchemaType<StoreType>();
            //services.AddSchemaType<UserType>();

            graphQlbuilder.AddGraphTypes(typeof(XPurchaseAnchor));

            services.AddSchemaBuilder <PurchaseSchema>();
            services.AddSingleton <IAuthorizationHandler, CanAccessCartAuthorizationHandler>();
            services.AddTransient <ICartAggregateRepository, CartAggregateRepository>();

            services.AddTransient <ICartValidationContextFactory, CartValidationContextFactory>();
            services.AddTransient <ICartAvailMethodsService, CartAvailMethodsService>();

            services.AddMediatR(typeof(XPurchaseAnchor));


            services.AddTransient <ICartProductService, CartProductService>();

            services.AddTransient <CartAggregate>();
            services.AddTransient <Func <CartAggregate> >(provider => () => provider.CreateScope().ServiceProvider.GetRequiredService <CartAggregate>());

            services.AddAutoMapper(typeof(XPurchaseAnchor));

            return(services);
        }
        public static IServiceCollection AddXCMS(this IServiceCollection services, IGraphQLBuilder graphQlbuilder)
        {
            graphQlbuilder.AddGraphTypes(typeof(XCMSAnchor));

            services.AddSchemaBuilder <ContentSchema>();

            services.AddMediatR(typeof(ContentSchema));

            return(services);
        }
        public static IServiceCollection AddXCore(this IServiceCollection services, IGraphQLBuilder graphQlbuilder)
        {
            graphQlbuilder.AddGraphTypes(typeof(XCoreAnchor));

            services.AddSchemaBuilder <DynamicPropertySchema>();
            services.AddSchemaBuilder <CoreSchema>();
            services.AddMediatR(typeof(XCoreAnchor));
            services.AddAutoMapper(typeof(XCoreAnchor));

            services.AddTransient <IDynamicPropertyResolverService, DynamicPropertyResolverService>();
            services.AddTransient <IDynamicPropertyUpdaterService, DynamicPropertyUpdaterService>();
            services.AddTransient <IUserManagerCore, UserManagerCore>();

            return(services);
        }
Example #5
0
        public static IServiceCollection AddXOrder(this IServiceCollection services, IGraphQLBuilder graphQlbuilder)
        {
            services.AddSingleton <ISchemaBuilder, OrderSchema>();

            graphQlbuilder.AddGraphTypes(typeof(XOrderAnchor));

            services.AddMediatR(typeof(XOrderAnchor));

            services.AddTransient <ICustomerOrderAggregateRepository, CustomerOrderAggregateRepository>();
            services.AddSingleton <IAuthorizationHandler, CanAccessOrderAuthorizationHandler>();

            services.AddAutoMapper(typeof(XOrderAnchor));

            return(services);
        }
Example #6
0
        public static IServiceCollection AddXProfile(this IServiceCollection services, IGraphQLBuilder graphQlbuilder)
        {
            services.AddSchemaBuilder <ProfileSchema>();

            graphQlbuilder.AddGraphTypes(typeof(XProfileAnchor));

            services.AddMediatR(typeof(XProfileAnchor));
            services.AddTransient <IMemberResolver, MemberResolver>();
            services.AddTransient <IOrganizationAggregateRepository, OrganizationAggregateRepository>();
            services.AddTransient <IContactAggregateRepository, ContactAggregateRepository>();
            services.AddSingleton <IAuthorizationHandler, ProfileAuthorizationHandler>();

            services.AddAutoMapper(typeof(XProfileAnchor));

            return(services);
        }
        public static IServiceCollection AddXOrder(this IServiceCollection services, IGraphQLBuilder graphQlbuilder)
        {
            services.AddSingleton <ISchemaBuilder, OrderSchema>();

            graphQlbuilder.AddGraphTypes(typeof(XOrderAnchor));

            services.AddMediatR(typeof(XOrderAnchor));

            services.AddTransient <ICustomerOrderAggregateRepository, CustomerOrderAggregateRepository>();
            services.AddSingleton <IAuthorizationHandler, CanAccessOrderAuthorizationHandler>();

            services.AddAutoMapper(typeof(XOrderAnchor));

            services.AddTransient <CustomerOrderAggregate>();
            services.AddTransient <Func <CustomerOrderAggregate> >(provider => () => provider.CreateScope().ServiceProvider.GetRequiredService <CustomerOrderAggregate>());

            return(services);
        }
        private void RegisterModuleGraphQLParts(IServiceCollection services, ApplicationPartManager appParts, IGraphQLBuilder builder)
        {
            var feature = new GraphQLFeature();

            appParts.PopulateFeature(feature);

            var assemblyHashSet = new HashSet <Assembly>();

            foreach (var part in feature.PartTypes)
            {
                var assembly = part.Assembly;
                if (assemblyHashSet.Add(assembly))
                {
                    builder.AddGraphTypes(assembly, ServiceLifetime.Scoped);
                    services.AddRootResolvers(assembly);
                }

                services.AddScoped(typeof(IGraphQLQueryProvider), part);
                services.AddScoped(typeof(IGraphQLMutationProvider), part);
            }
        }
Example #9
0
 /// <summary>
 /// Add all types that implement <seealso cref="IGraphType"/> in the calling assembly
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static IGraphQLBuilder AddGraphTypes(this IGraphQLBuilder builder)
 {
     return(builder.AddGraphTypes(Assembly.GetCallingAssembly()));
 }
Example #10
0
 /// <summary>
 /// Add all types that implement <seealso cref="IGraphType"/> in the calling assembly
 /// </summary>
 /// <param name="builder">GraphQL builder used for GraphQL specific extension methods as 'this' argument.</param>
 /// <param name="serviceLifetime">The service lifetime to register the GraphQL types with</param>
 /// <returns>Reference to <paramref name="builder"/>.</returns>
 public static IGraphQLBuilder AddGraphTypes(
     this IGraphQLBuilder builder,
     ServiceLifetime serviceLifetime = ServiceLifetime.Singleton)
 => builder.AddGraphTypes(Assembly.GetCallingAssembly(), serviceLifetime);
Example #11
0
 /// <summary>
 /// Add all types that implement <seealso cref="IGraphType"/> in the assembly which <paramref name="typeFromAssembly"/> belongs to
 /// </summary>
 /// <param name="builder">GraphQL builder used for GraphQL specific extension methods as 'this' argument.</param>
 /// <param name="typeFromAssembly">The type from assembly to register all GraphQL types from</param>
 /// <param name="serviceLifetime">The service lifetime to register the GraphQL types with</param>
 /// <returns>Reference to <paramref name="builder"/>.</returns>
 public static IGraphQLBuilder AddGraphTypes(
     this IGraphQLBuilder builder,
     Type typeFromAssembly,
     ServiceLifetime serviceLifetime = ServiceLifetime.Singleton)
 => builder.AddGraphTypes(typeFromAssembly.Assembly, serviceLifetime);
 public static IGraphQLBuilder AddWappaGraphTypes(
     this IGraphQLBuilder builder,
     ServiceLifetime serviceLifetime = ServiceLifetime.Singleton)
 {
     return(builder.AddGraphTypes(typeof(WappaGraphQLBuilderExtensions).Assembly, serviceLifetime));
 }