示例#1
0
 private static void RegisterLanguageSwitchProviders(IComposerHost host)
 {
     host.Register <LanguageSwitchContext, ILanguageSwitchContext>(ComponentLifestyle.PerRequest);
     host.Register <LanguageSwitchProvider, ILanguageSwitchProvider>();
     host.Register <ProductLanguageSwitchProvider, ILanguageSwitchProvider>();
     host.Register <StoreLanguageSwitchProvider, ILanguageSwitchProvider>();
 }
        public void Register(IComposerHost host)
        {
            host.Register <ContentSearchViewService, IContentSearchViewService>(ComponentLifestyle.Transient);
            host.Register <MediaSearchDocumentBuilderExtension, ISearchDocumentBuilderExtension>(ComponentLifestyle.Singleton);

            host.RegisterApiControllers(typeof(ContentSearchPlugin).Assembly);
        }
示例#3
0
        public void Register(IComposerHost host)
        {
            host.Register <SearchQueryUrlProvider, ISearchQueryUrlProvider>();

            host.RegisterApiControllers(typeof(Plugin).Assembly);
            host.RegisterControllers(typeof(Plugin).Assembly);
        }
示例#4
0
        private void HostOnInitialized(object sender, EventArgs eventArgs)
        {
            IComposerHost host = (IComposerHost)sender;

            RegisterHandlebarsHelpers(host);
            RegisterLocalizedHandlebarsHelpers(host);
        }
示例#5
0
        public void Register(IComposerHost host)
        {
            host.Register <TestCookieAccessor, ICookieAccessor <TestCookieDto> >(ComponentLifestyle.PerRequest);
            host.Register <TestInventoryLocationProvider, IInventoryLocationProvider>();

            host.RegisterApiControllers(typeof(TestPlugin).Assembly);
        }
 public static void ConfigureServices(IServiceCollection collection)
 {
     _host = new ComposerHost();
     _host.LoadPlugins();
     foreach (var type in _host.RegisteredInterfaces)
     {
         collection.AddTransient(type, provider => AutofacDependencyResolver.Current.GetService(type));
     }
 }
 public void Register(IComposerHost host)
 {
     host.Register <SearchQueryContext, ISearchQueryContext>(ComponentLifestyle.PerRequest);
     host.Register <SearchQueryRepository, ISearchQueryRepository>();
     host.Register <InventoryRepository, IInventoryRepository>();
     host.Register <SearchQueryViewService, ISearchQueryViewService>();
     host.RegisterApiControllers(typeof(SearchQueryPlugin).Assembly);
     host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(typeof(SearchQueryPlugin).Assembly);
 }
示例#8
0
 private static void RegisterBreadcrumProviders(IComposerHost host)
 {
     host.Register <BreadcrumbContext, IBreadcrumbContext>(ComponentLifestyle.PerRequest);
     host.Register <BreadcrumbProvider, IBreadcrumbProvider>();
     host.Register <ProductBreadcrumbProvider, IBreadcrumbProvider>();
     host.Register <StoreBreadcrumbProvider, IBreadcrumbProvider>();
     host.Register <ChekoutBreadcrumbProvider, IBreadcrumbProvider>();
     host.Register <SearchBreadcrumbProvider, IBreadcrumbProvider>();
 }
示例#9
0
        private void RegisterLocalizedHandlebarsHelpers(IComposerHost host)
        {
            ILocalizationProvider localizationProvider = host.Resolve <ILocalizationProvider>();

            host.RegisterHandlebarsHelper(new FormatValueHelper());
            host.RegisterHandlebarsHelper(new IfIsLocalizedBlockHelper(localizationProvider));
            host.RegisterHandlebarsHelper(new LocalizeHelper(localizationProvider));
            host.RegisterHandlebarsHelper(new LocalizeFormatHelper(localizationProvider));
        }
        public void Register(IComposerHost host)
        {
            host.Register <SearchQueryContext, ISearchQueryContext>();
            host.Register <SearchQueryRepository, ISearchQueryRepository>();
            host.Register <InventoryRepository, IInventoryRepository>();
            host.Register <SearchQueryViewService, ISearchQueryViewService>();

            host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(typeof(SearchPlugin).Assembly);
        }
示例#11
0
        private void RegisterDependencies(IComposerHost host)
        {
            host.Register <RecurringOrdersSettings, IRecurringOrdersSettings>(ComponentLifestyle.PerRequest);
            host.Register <GoogleSettings, IGoogleSettings>(ComponentLifestyle.PerRequest);
            host.Register <WebsiteContext, IWebsiteContext>(ComponentLifestyle.PerRequest);
            host.Register <EmptyFulfillmentContext, IFulfillmentContext>(ComponentLifestyle.Singleton);
            host.Register <AntiCookieTamperingExcluder, IAntiCookieTamperingExcluder>();
            host.Register <Providers.ScopeProvider, IScopeProvider>(ComponentLifestyle.PerRequest);
            host.Register <Providers.ProductUrlProvider, IProductUrlProvider>(ComponentLifestyle.PerRequest);
            host.Register <Providers.CountryCodeProvider, ICountryCodeProvider>(ComponentLifestyle.PerRequest);
            host.Register <FacetConfigurationContext, IFacetConfigurationContext>(ComponentLifestyle.PerRequest);
            host.Register <CategoryMetaContext, ICategoryMetaContext>(ComponentLifestyle.PerRequest);
            host.Register <PageService, IPageService>();
            host.Register <CultureService, ICultureService>(ComponentLifestyle.Singleton);
            host.Register <GoogleAnalyticsNavigationUrlProvider>();
            host.Register <NavigationMapper, INavigationMapper>();

            host.Register <SearchUrlProvider, ISearchUrlProvider>();
            host.Register <CategoryBrowsingUrlProvider, ICategoryBrowsingUrlProvider>();
            host.Register <CartUrlProvider, ICartUrlProvider>();
            host.Register <MyAccountUrlProvider, IMyAccountUrlProvider>();
            host.Register <WishListUrlProvider, IWishListUrlProvider>();
            host.Register <RecurringScheduleUrlProvider, IRecurringScheduleUrlProvider>();
            host.Register <RecurringCartUrlProvider, IRecurringCartUrlProvider>();
            host.Register <CategoryPageService, ICategoryBrowsingService>();
            host.Register <ImageViewService, IImageViewService>();
            host.Register <MediaService, IMediaService>();
            host.Register <OrderUrlProvider, IOrderUrlProvider>();
            host.Register <Providers.StoreUrlProvider, IStoreUrlProvider>();
            host.Register <LanguageSwitchViewService, ILanguageSwitchService>();
            host.Register <BreadcrumbViewService, IBreadcrumbViewService>();
            // TODO: Why not done in Composer directly ??
            host.Register <SettingsFromConfigFileService, ISettingsService>();
            host.Register <MyAccountViewService, IMyAccountViewService>();
            host.Register <PageNotFoundUrlProvider, IPageNotFoundUrlProvider>();
            host.Register <C1PerformanceDataCollector, IPerformanceDataCollector>();
            host.Register <DataQueryService, IDataQueryService>();
            host.Register <SiteConfiguration, ISiteConfiguration>(ComponentLifestyle.Singleton);
            host.Register <CookieAccesserSettings, ICookieAccesserSettings>(ComponentLifestyle.Singleton);
            host.Register <CdnDamProviderSettings, ICdnDamProviderSettings>(ComponentLifestyle.Singleton);
            host.Register <CacheService, ICacheService>(ComponentLifestyle.Singleton);
            host.Register <PreviewModeService, IPreviewModeService>();
            host.Register <AutocompleteProvider, IAutocompleteProvider>();
            host.Register <Scheduler, IScheduler>(ComponentLifestyle.Singleton);

            host.Register <ProductContext, IProductContext>(ComponentLifestyle.PerRequest);
            host.Register <StoreContext, IStoreContext>(ComponentLifestyle.PerRequest);
            host.Register <LazyFunctionCallDataProvider, ILazyFunctionCallDataProvider>();
            host.Register <BaseSearchCriteriaProvider, IBaseSearchCriteriaProvider>();

            host.Register <EditingOrderProvider, IEditingOrderProvider>();
            RegisterBreadcrumProviders(host);
            RegisterLanguageSwitchProviders(host);

            host.RegisterApiControllers(typeof(Plugin).Assembly);
        }
示例#12
0
        public void Register(IComposerHost host)
        {
            ComposerConfig.RegisterConfigurations();

            host.RegisterControllers(GetType().Assembly);
            host.RegisterApiControllers(GetType().Assembly);
            host.RegisterExceptionFiltersForApiControllers(typeof(AggregatedComposerExceptionFilter), typeof(ComposerExceptionFilter));
            host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(GetType().Assembly);
            RegisterPaymentProviders();
        }
示例#13
0
 private void RegisterHandlebarsHelpers(IComposerHost host)
 {
     host.RegisterHandlebarsHelper(new IfEqualsBlockHelper());
     host.RegisterHandlebarsHelper(new IfNotEqualsBlockHelper());
     host.RegisterHandlebarsHelper(new IfExistsBlockHelper());
     host.RegisterHandlebarsHelper(new IfGtBlockHelper());
     host.RegisterHandlebarsHelper(new IfGteBlockHelper());
     host.RegisterHandlebarsHelper(new IfLtBlockHelper());
     host.RegisterHandlebarsHelper(new IfLteBlockHelper());
     host.RegisterHandlebarsHelper(new EscapeHelper());
     host.RegisterHandlebarsHelper(new LookupHelper());
 }
示例#14
0
        public void Register(IComposerHost host)
        {
            host.Register <MembershipViewService, IMembershipViewService>();
            host.Register <CustomerRepository, ICustomerRepository>();
            host.Register <CustomerAddressRepository, ICustomerAddressRepository>();
            host.Register <CustomerAddressViewService, ICustomerAddressViewService>();
            host.Register <CustomerViewService, ICustomerViewService>();

            host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(typeof(MyAccountPlugin).Assembly);

            host.RegisterApiControllers(typeof(MyAccountPlugin).Assembly);
        }
        private static void RegisterFacetProviders(IComposerHost host)
        {
            host.Register <IFacetProviderRegistry>(SearchConfiguration.FacetProviderRegistry);
            host.Register <FacetFactory, IFacetFactory>(ComponentLifestyle.Transient);
            host.Register <RangeFacetProvider>(ComponentLifestyle.Transient);
            host.Register <MultiSelectFacetProvider>(ComponentLifestyle.Transient);
            host.Register <SingleSelectFacetProvider>(ComponentLifestyle.Transient);

            SearchConfiguration.FacetProviderRegistry.RegisterProvider <MultiSelectFacetProvider>(
                FacetType.MultiSelect.ToString());
            SearchConfiguration.FacetProviderRegistry.RegisterProvider <RangeFacetProvider>(FacetType.Range.ToString());
            SearchConfiguration.FacetProviderRegistry.RegisterProvider <SingleSelectFacetProvider>(
                FacetType.SingleSelect.ToString());
        }
 public void Register(IComposerHost host)
 {
     host.Register <GoogleMapsUrlProvider, IGoogleMapsUrlProvider>();
     host.Register <StoreViewService, IStoreViewService>();
     host.Register <StoreScheduleViewService, IStoreScheduleViewService>();
     host.Register <StoreLocatorViewService, IStoreLocatorViewService>();
     host.Register <StoreRepository, IStoreRepository>();
     host.Register <StoreViewModelFactory, IStoreViewModelFactory>();
     host.Register <StoreDirectoryViewService, IStoreDirectoryViewService>();
     host.Register <StoreInventoryViewService, IStoreInventoryViewService>();
     host.Register <StoreScheduleProvider, IStoreScheduleProvider>();
     host.Register <MapClustererProvider, IMapClustererProvider>();
     host.Register <MapConfigurationViewService, IMapConfigurationViewService>();
     host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(typeof(StorePlugin).Assembly);
     host.RegisterApiControllers(typeof(StorePlugin).Assembly);
 }
        public void SetUp()
        {
            // Reset static properties
            typeof(Composer.ComposerHost)
            .GetProperty("Current")
            .GetSetMethod(true)
            .Invoke(null, new object[] { null });

            //Reset Handlerbars static state
            Handlebars.Configuration.Helpers.Clear();
            Handlebars.Configuration.BlockHelpers.Clear();


            // Default setup for all required entities
            Composer.ComposerHost host = new Composer.ComposerHost(Assembly.GetExecutingAssembly());

            // Mock AspNetConfigManager
            Mock <IAspNetConfigurationManager> aspNetConfigManagerMock = new Mock <IAspNetConfigurationManager>(MockBehavior.Strict);

            aspNetConfigManagerMock
            .Setup(config => config.Configure(It.IsAny <ILifetimeScope>(), It.IsAny <IViewEngine>(), It.IsAny <MediaTypeFormatter>()));
            host.SetAspNetConfigurationManager(aspNetConfigManagerMock.Object);

            // Mock AssemblyHelper
            var assemblyHelper = new Mock <Composer.AssemblyHelper>();

            assemblyHelper.Setup(helper => helper.SafeLoadAssemblies(It.IsAny <string>()))
            .Returns(() => new _Assembly[0]);
            host.SetAssemblyHelper(assemblyHelper.Object);

            // Mock Composer Environment
            var composerEnvironment = ComposerEnvironmentFactory.Create();

            host.SetComposerEnvironment(composerEnvironment.Object);

            //Add some additionnal dependencies expected to be set by a plugin (what?!)
            var lookupService = new Mock <ILookupService>(MockBehavior.Strict);

            host.Register <ILookupService>(lookupService.Object);
            var currencyProviderMock = new Mock <ICurrencyProvider>(MockBehavior.Strict);

            host.Register <ICurrencyProvider>(currencyProviderMock.Object);
            _composerHost      = host;
            _serviceLocatorMoq = new ServiceLocatorMoq();
        }
        public void Register(IComposerHost host)
        {
            host.Register <ProductViewService, IProductViewService>();
            host.Register <RelationshipRepository, IRelationshipRepository>();
            host.Register <CategoryViewService, ICategoryViewService>();
            host.Register <ConventionBasedDamProvider, IDamProvider>();
            host.Register <ProductBreadcrumbService, IProductBreadcrumbService>();
            host.Register <ProductSpecificationsViewService, IProductSpecificationsViewService>();
            host.Register <ProductViewModelFactory, IProductViewModelFactory>();
            host.Register <RelatedProductViewService, IRelatedProductViewService>();
            host.Register <InventoryViewService, IInventoryViewService>();
            host.Register <ConfigurationInventoryLocationProvider, IInventoryLocationProvider>();
            host.Register <ProductMediaSettingsRepository, IProductMediaSettingsRepository>(ComponentLifestyle.Singleton);

            host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(typeof(ProductPlugin).Assembly);

            host.RegisterApiControllers(typeof(ProductPlugin).Assembly);
        }
        /// <summary>
        /// Autowireup this plugin
        /// </summary>
        /// <param name="host"></param>
        public void Register(IComposerHost host)
        {
            host.Register <CartService, ICartService>();
            host.Register <CouponViewService, ICouponViewService>();
            host.Register <CartRepository, ICartRepository>();
            host.Register <CheckoutService, ICheckoutService>();
            host.Register <FulfillmentMethodRepository, IFulfillmentMethodRepository>();
            host.Register <CartViewModelFactory, ICartViewModelFactory>();
            host.Register <ShippingMethodViewService, IShippingMethodViewService>();
            host.Register <FulfillmentMethodRepository, IFulfillmentMethodRepository>();
            host.Register <PaymentViewService, IPaymentViewService>();
            host.Register <PaymentRepository, IPaymentRepository>();
            host.Register <CheckoutBreadcrumbViewService, ICheckoutBreadcrumbViewService>();
            host.Register <VaultProfileRepository, IVaultProfileRepository>();
            host.Register <VaultProfileViewService, IVaultProfileViewService>();
            host.Register <CheckoutNavigationViewService, ICheckoutNavigationViewService>();

            host.Register <OrderRepository, IOrderRepository>();
            host.Register <OrderHistoryViewService, IOrderHistoryViewService>();
            host.Register <OrderHistoryViewModelFactory, IOrderHistoryViewModelFactory>();
            host.Register <FindOrdersRequestFactory, IFindOrdersRequestFactory>();
            host.Register <OrderDetailsViewModelFactory, IOrderDetailsViewModelFactory>();
            host.Register <LineItemService, ILineItemService>();
            host.Register <TaxViewModelFactory, ITaxViewModelFactory>();
            host.Register <LineItemViewModelFactory, ILineItemViewModelFactory>();
            host.Register <RewardViewModelFactory, IRewardViewModelFactory>();
            host.Register <FixCartService, IFixCartService>();

            host.Register <CartMergeProvider, ICartMergeProvider>();
            host.Register <SurfacedErrorLineItemValidationProvider, ILineItemValidationProvider>();

            host.Register <WishListViewService, IWishListViewService>();
            host.Register <WishListRepository, IWishListRepository>();

            host.Register <RecurringOrderCartViewModelFactory, IRecurringOrderCartViewModelFactory>();
            host.Register <RecurringOrderCartsViewService, IRecurringOrderCartsViewService>();

            host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(typeof(CartPlugin).Assembly);

            host.RegisterApiControllers(typeof(CartPlugin).Assembly);

            RegisterPaymentProviders(host);
            RegisterShippingTrackingProviders(host);
        }
        public void Register(IComposerHost host)
        {
            host.Register <CategoryBrowsingViewService, ICategoryBrowsingViewService>();
            host.Register <SearchViewService, ISearchViewService>();
            host.Register <SearchRepository, ISearchRepository>();
            host.Register <ProductRequestFactory, IProductRequestFactory>();
            host.Register <SearchRequestContext, ISearchRequestContext>(ComponentLifestyle.PerRequest);
            host.Register <BrowseCategoryRequestContext, IBrowseCategoryRequestContext>(ComponentLifestyle.PerRequest);
            host.Register <SearchBreadcrumbViewService, ISearchBreadcrumbViewService>();
            host.Register <FacetLocalizationProvider, IFacetLocalizationProvider>();
            host.Register <FromPriceProvider, IPriceProvider>();
            host.Register <SearchTermsTransformationProvider, ISearchTermsTransformationProvider>();

            host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(typeof(SearchPlugin).Assembly);

            host.RegisterApiControllers(typeof(SearchPlugin).Assembly);

            RegisterFacetProviders(host);
            RegisterFacetPredicateProviders(host);
            RegisterSelectedFacetProviders(host);
        }
示例#21
0
        public void Register(IComposerHost host)
        {
            host.Register <ComposerCookieAccessor, ICookieAccessor <ComposerCookieDto> >(ComponentLifestyle.PerRequest);
            host.Register <ComposerContext, IComposerContext>(ComponentLifestyle.PerRequest);
            host.Register <RegionCodeProvider, IRegionCodeProvider>();
            //host.Register<ScopeProvider, IScopeProvider>();
            host.Register <CountryRepository, ICountryRepository>();
            host.Register <CountryService, ICountryService>();
            host.Register <CategoryRepository, ICategoryRepository>();
            host.Register <LookupRepositoryFactory, ILookupRepositoryFactory>();
            host.Register <LookupService, ILookupService>();
            host.Register <AddressRepository, IAddressRepository>();
            host.Register <FulfillmentLocationsRepository, IFulfillmentLocationsRepository>();
            host.Register <ProductSettingsRepository, IProductSettingsRepository>();
            host.Register <ProductSettingsViewService, IProductSettingsViewService>();
            host.Register <ScopeRepository, IScopeRepository>();
            host.Register <ScopeViewService, IScopeViewService>();
            host.Register <InventoryRepository, IInventoryRepository>();
            host.Register <ImageService, IImageService>();
            host.Register <CurrencyProvider, ICurrencyProvider>();
            host.Register <RecurringOrdersRepository, IRecurringOrdersRepository>();
            host.Register <RecurringOrderTemplatesViewService, IRecurringOrderTemplatesViewService>();
            host.Register <RecurringOrderTemplateViewModelFactory, IRecurringOrderTemplateViewModelFactory>();
            host.Register <RecurringOrderProgramViewModelFactory, IRecurringOrderProgramViewModelFactory>();
            host.Register <ProductPriceViewService, IProductPriceViewService>();
            host.Register <ProductRepository, IProductRepository>();
            host.Register <RegexRulesProvider, IRegexRulesProvider>();

            host.MetadataRegistry.LoadViewModelMetadataInAssemblyOf(GetType().Assembly);

            host.RegisterControllers(GetType().Assembly);
            host.RegisterApiControllers(GetType().Assembly);

            RegisterSpecializedRoutes(RouteTable.Routes);

            host.Initialized += HostOnInitialized;
        }
示例#22
0
 public void Register(IComposerHost host)
 {
     WasDiscovered = true;
 }
示例#23
0
        public void Register(IComposerHost host)
        {
            RegisterDependencies(host);

            CategoriesConfiguration.CategoriesSyncConfiguration.Add("RootPageId", new Guid("f3dbd28d-365f-4d3e-91c3-7b730b39b294"));
        }