Esempio n. 1
0
        private static void SetupMediaR(IServiceConfigurationProvider container)
        {
            try
            {
                var test = typeof(ProductHandle);

                var types = AppDomain.CurrentDomain.GetAssemblies()
                            .Where(x => x.FullName.StartsWith("MovieShop"))
                            .SelectMany(s => s.GetTypes());

                foreach (var type in types)
                {
                    foreach (Type intType in type.GetInterfaces())
                    {
                        if (intType.IsGenericType && intType.GetGenericTypeDefinition() == typeof(IRequestHandler <,>))
                        {
                            container.AddTransient(intType, type);
                        }
                    }
                }
                container.AddSingleton <ServiceFactory>(ctx => ctx.GetInstance);
                container.AddTransient <IMediator, Mediator>();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 2
0
        private static void SetupExternal(IServiceConfigurationProvider container)
        {
            container.AddTransient <IBlobFilenameRepository, BlobFilenameRepository>();
            container.AddTransient <IImageRepository, ImageRepository>();

            container.AddTransient <IBlobRepository, BlobRepository>();
            container.AddTransient <ICart>(x => x.GetInstance <ICartFactory>().LoadOrCreateCart());

            container.AddSingleton <ICookieHelper, CookieHelper>();
            container.AddSingleton <ICookieRepository>(x => new CookieRepository(false, x.GetInstance <ICookieHelper>()));

            container.AddSingleton <IVocabulary>(x => CreateVocabulary(x.GetInstance <IBlobRepository>()));

            container.AddSingleton <ITernaryTreeFactory, TernaryTreeFactory>();
            container.AddSingleton <ITernarySearch>(x => x.GetInstance <ITernaryTreeFactory>().GenerateTree());
            container.AddSingleton <ITokinizer>(new Tokinizer(new HashSet <string>()
            {
                "-", "!", "?", ".", "\"", "(", ")", ":", ";", ","
            }));
            container.AddSingleton <IDocumentStorage, DocumentStore>();
            container.AddSingleton <SearchFactory, SearchFactory>();
            container.AddSingleton <ISearchEngine>(x => x.GetInstance <SearchFactory>().CreateSearch());
            container.AddSingleton <IBiGram>(x => x.GetInstance <SearchFactory>().CreateBiGram());
            container.AddSingleton <ITriGram>(x => x.GetInstance <SearchFactory>().CreateTriGram());
            container.AddSingleton <ISentencezer>(new Sentencezer(new Tokinizer(new HashSet <string>()
            {
                "-", "\"", "(", ")", ":", ";", ","
            })));

            container.AddSingleton <IConnectionSettingsValues>(new ConnectionSettings(new Uri("http://localhost:9200")).DefaultIndex("movie"));
            container.AddSingleton <ElasticClient>(s => new ElasticClient(s.GetInstance <IConnectionSettingsValues>()));
            container.AddSingleton <IMovieSearch, MovieSearch>();
        }
Esempio n. 3
0
 public static void RegisterVueStorefrontBridgeDefaultService(this IServiceConfigurationProvider services, VsfApiBridgeConfiguration bridgeConfiguration)
 {
     services.AddSingleton(bridgeConfiguration);
     services.AddTransient <IUserEndpoint, UserEndpoint <VsfUser> >();
     services.AddTransient <ICartEndpoint, CartEndpoint>();
     services.AddTransient <IStockEndpoint, StockEndpoint>();
     services.AddTransient <IOrderEndpoint, OrderEndpoint>();
     services.AddScoped <QuicksilverDbContext>();
     services.AddScoped <IRefreshTokenRepository, DatabaseRefreshTokenRepository>();
     services.AddScoped <IUserTokenProvider, JwtUserTokenProvider>();
     services.AddTransient <IUserClaimsProvider <VsfUser>, UserClaimsProvider <VsfUser> >();
 }
Esempio n. 4
0
        private void ContextOnInitComplete(object sender, EventArgs eventArgs)
        {
            _services.AddTransient <ContentAreaRenderer, FoundationContentAreaRenderer>();
            Extensions.InstallDefaultContent();
            var settings = _locator.GetInstance <ISettingsService>().GetSiteSettings <SearchSettings>();

            if (settings != null)
            {
                InitializeFacets(settings.SearchFiltersConfiguration);
            }

            _locator.GetInstance <IContentEvents>().PublishedContent += OnPublishedContent;
        }
Esempio n. 5
0
 void IConfigurableModule.ConfigureContainer(ServiceConfigurationContext context)
 {
     _services = context.Services;
     _services.AddTransient(_ => HttpContext.Current.GetOwinContext());
     _services.AddTransient(locator => locator.GetInstance <IOwinContext>().GetUserManager <ApplicationUserManager <SiteUser> >()).AddServiceAccessor();
     _services.AddTransient(locator => locator.GetInstance <IOwinContext>().Authentication).AddServiceAccessor();
     _services.AddTransient(locator => locator.GetInstance <IOwinContext>().Get <ApplicationSignInManager <SiteUser> >()).AddServiceAccessor();
     _services.AddSingleton <IDisplayModeFallbackProvider, FoundationDisplayModeProvider>();
     _services.AddTransient <IsInEditModeAccessor>(locator => () => PageEditing.PageIsInEditMode);
     _services.AddSingleton <ServiceAccessor <IContentRouteHelper> >(locator => locator.GetInstance <IContentRouteHelper>);
     _services.AddTransient <IModelBinderProvider, ModelBinderProvider>();
     _services.AddSingleton <CookieService>();
     _services.AddSingleton <BlogTagFactory>();
     _services.AddTransient <IQuickNavigatorItemProvider, FoundationQuickNavigatorItemProvider>();
     _services.AddTransient <IViewTemplateModelRegistrator, ViewTemplateModelRegistrator>();
 }
Esempio n. 6
0
 void IConfigurableModule.ConfigureContainer(ServiceConfigurationContext context)
 {
     _services = context.Services;
     _services.AddTransient(_ => HttpContext.Current.GetOwinContext());
     _services.AddTransient(locator => locator.GetInstance <IOwinContext>().GetUserManager <ApplicationUserManager <SiteUser> >()).AddServiceAccessor();
     _services.AddTransient(locator => locator.GetInstance <IOwinContext>().Authentication).AddServiceAccessor();
     _services.AddTransient(locator => locator.GetInstance <IOwinContext>().Get <ApplicationSignInManager <SiteUser> >()).AddServiceAccessor();
     _services.AddTransient <IsInEditModeAccessor>(locator => () => PageEditing.PageIsInEditMode);
     _services.AddSingleton <ServiceAccessor <IContentRouteHelper> >(locator => locator.GetInstance <IContentRouteHelper>);
     _services.AddTransient <IModelBinderProvider, ModelBinderProvider>();
     _services.AddSingleton <IUserService, UserService>();
     _services.AddSingleton <CookieService>();
 }
Esempio n. 7
0
        public static void RegisterVueStorefrontExporterDefaultService <TProduct>(this IServiceConfigurationProvider services, VsfExporterConfiguration vsfExporterConfiguration) where TProduct : VsfBaseProduct
        {
            services.AddSingleton(vsfExporterConfiguration);

            services.AddTransient <IAttributeMapper, AttributeMapper>();
            services.AddTransient <IMapper <VariationContent, VsfSimpleProduct>, SimpleProductMapper>();

            services.AddTransient <IContentExtractor, ContentExtractor>();
            services.AddSingleton <IVsfPriceService, VsfPriceService>();

            services.AddTransient <IExtractedContentHandler, ExtractedContentHandler <TProduct> >();
            services.AddTransient <IIndexingService, IndexingService <TProduct> >();

            services.AddTransient <IContentLoaderWrapper, CachedContentLoaderWrapper>(sc => new CachedContentLoaderWrapper(new ContentLoaderWrapper(sc.GetInstance <IContentLoader>())));
        }
Esempio n. 8
0
 private void ContextOnInitComplete(object sender, EventArgs eventArgs)
 {
     _services.AddTransient <ContentAreaRenderer, FoundationContentAreaRenderer>();
 }
Esempio n. 9
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            _services = context.Services;
            context.ConfigureFoundationCms();

            _services.Configure <ContentApiConfiguration>(c =>
            {
                c.EnablePreviewFeatures = true;
                c.Default().SetMinimumRoles(string.Empty).SetRequiredRole(string.Empty);
            });

            _services.Configure <ContentApiSearchConfiguration>(config =>
            {
                config.Default()
                .SetMaximumSearchResults(200)
                .SetSearchCacheDuration(TimeSpan.FromMinutes(60));
            });

            _services.AddSingleton <IDisplayModeFallbackProvider, FoundationDisplayModeProvider>();
            _services.AddTransient <IQuickNavigatorItemProvider, FoundationQuickNavigatorItemProvider>();
            _services.AddTransient <IViewTemplateModelRegistrator, ViewTemplateModelRegistrator>();
            _services.AddSingleton <DefaultPlacedPriceProcessor, FoundationPlacedPriceProcessor>();
            _services.AddSingleton <ISearchViewModelFactory, SearchViewModelFactory>();
            _services.AddSingleton <IPaymentService, PaymentService>();
            _services.AddTransient <CheckoutViewModelFactory>();
            _services.AddSingleton <MultiShipmentViewModelFactory>();
            _services.AddSingleton <OrderSummaryViewModelFactory>();
            _services.AddTransient <PaymentMethodViewModelFactory>();
            _services.AddSingleton <IBookmarksService, BookmarksService>();
            _services.AddSingleton <IPricingService, PricingService>();
            _services.AddSingleton <IB2BNavigationService, B2BNavigationService>();
            _services.AddSingleton <IBudgetService, BudgetService>();
            _services.AddSingleton <ICreditCardService, CreditCardService>();
            _services.AddSingleton <IGiftCardService, GiftCardService>();
            _services.AddSingleton <IOrganizationService, OrganizationService>();
            _services.AddSingleton <IQuickOrderService, QuickOrderService>();
            _services.AddSingleton <IProductService, ProductService>();
            _services.AddSingleton <IPromotionService, PromotionService>();
            _services.AddSingleton <IStoreService, StoreService>();
            _services.AddSingleton <CatalogEntryViewModelFactory>();
            _services.AddSingleton <IHeaderViewModelFactory, HeaderViewModelFactory>();
            _services.AddSingleton <IAddressBookService, AddressBookService>();
            _services.AddSingleton <CartItemViewModelFactory>();
            _services.AddSingleton <ICartService, CartService>();
            _services.AddSingleton <CartViewModelFactory>();
            _services.AddSingleton <IOrdersService, OrdersService>();
            _services.AddSingleton <ShipmentViewModelFactory>();
            _services.AddSingleton <IShippingService, ShippingService>();
            _services.AddSingleton <ICampaignService, CampaignService>();
            _services.AddSingleton <IHtmlDownloader, HtmlDownloader>();
            _services.AddTransient <IMailService, MailService>();
            _services.AddSingleton <BlogTagFactory>();
            _services.AddTransient <IPaymentMethod, BudgetPaymentOption>();
            _services.AddTransient <IPaymentMethod, CashOnDeliveryPaymentOption>();
            _services.AddTransient <IPaymentMethod, GenericCreditCardPaymentOption>();
            _services.AddTransient <IPaymentMethod, GiftCardPaymentOption>();
            _services.AddSingleton <ISearchService, SearchService>();
            _services.AddSingleton <CatalogContentClientConventions, FoundationFindConventions>();
            _services.AddSingleton <CatalogContentEventListener, FoundationCatalogContentEventListener>();
            _services.AddSingleton <IModelBinderProvider, FilterOptionModelBinderProvider>();
            _services.AddSingleton <IModelBinderProvider, PaymentModelBinderProvider>();
            _services.AddTransient <IContentQuery, LandingPagesSlice>();
            _services.AddTransient <IContentSlice, LandingPagesSlice>();
            _services.AddTransient <IContentQuery, StandardPagesSlice>();
            _services.AddTransient <IContentSlice, StandardPagesSlice>();
            _services.AddTransient <IContentQuery, BlogsSlice>();
            _services.AddTransient <IContentSlice, BlogsSlice>();
            _services.AddTransient <IContentQuery, BlocksSlice>();
            _services.AddTransient <IContentSlice, BlocksSlice>();
            _services.AddTransient <IContentQuery, MediaSlice>();
            _services.AddTransient <IContentSlice, MediaSlice>();
            _services.AddTransient <IContentQuery, ImagesSlice>();
            _services.AddTransient <IContentSlice, ImagesSlice>();
            _services.AddTransient <IContentQuery, EverythingSlice>();
            _services.AddTransient <IContentSlice, EverythingSlice>();
            _services.AddTransient <IContentQuery, MyContentSlice>();
            _services.AddTransient <IContentSlice, MyContentSlice>();
            _services.AddTransient <IContentQuery, MyPagesSlice>();
            _services.AddTransient <IContentSlice, MyPagesSlice>();
            _services.AddTransient <IContentQuery, UnusedMediaSlice>();
            _services.AddTransient <IContentSlice, UnusedMediaSlice>();
            _services.AddTransient <IContentQuery, UnusedBlocksSlice>();
            _services.AddTransient <IContentSlice, UnusedBlocksSlice>();
            _services.AddTransient <IContentQuery, ProductsSlice>();
            _services.AddTransient <IContentSlice, ProductsSlice>();
            _services.AddTransient <IContentQuery, PackagesSlice>();
            _services.AddTransient <IContentSlice, PackagesSlice>();
            _services.AddTransient <IContentQuery, BundlesSlice>();
            _services.AddTransient <IContentSlice, BundlesSlice>();
            _services.AddTransient <IContentQuery, VariantsSlice>();
            _services.AddTransient <IContentSlice, VariantsSlice>();
            _services.AddTransient <IContentQuery, OrderPromotionsSlice>();
            _services.AddTransient <IContentSlice, OrderPromotionsSlice>();
            _services.AddTransient <IContentQuery, ShippingPromotionsSlice>();
            _services.AddTransient <IContentSlice, ShippingPromotionsSlice>();
            _services.AddTransient <IContentQuery, EntryPromotionsSlice>();
            _services.AddTransient <IContentSlice, EntryPromotionsSlice>();
            _services.AddSingleton <ISchemaDataMapper <BlogItemPage>, BlogItemPageSchemaMapper>();
            _services.AddSingleton <ISchemaDataMapper <HomePage>, HomePageSchemaMapper>();
            _services.AddSingleton <ISchemaDataMapper <GenericProduct>, GenericProductSchemaDataMapper>();
            _services.AddSingleton <ISchemaDataMapper <LocationItemPage>, LocationItemPageSchemaDataMapper>();
        }
Esempio n. 10
0
 private static void SetupSettings(IServiceConfigurationProvider container)
 {
     container.AddTransient <IMenuSettings>(x => x.GetInstance <ISettingsService>().GetSetting <IMenuSettings>());
 }
Esempio n. 11
0
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            _services = context.Services;
            context.ConfigureFoundationCms();

            _services.Configure <ContentApiConfiguration>(c =>
            {
                c.EnablePreviewFeatures = true;
                c.Default(RestVersion.Version_3_0).SetMinimumRoles(string.Empty).SetRequiredRole(string.Empty);
                c.Default(RestVersion.Version_2_0).SetMinimumRoles(string.Empty).SetRequiredRole(string.Empty);
            });

            _services.Configure <ContentApiSearchConfiguration>(config =>
            {
                config.Default()
                .SetMaximumSearchResults(200)
                .SetSearchCacheDuration(TimeSpan.FromMinutes(60));
            });

            _services.AddSingleton <IDisplayModeFallbackProvider, FoundationDisplayModeProvider>();
            _services.AddTransient <IQuickNavigatorItemProvider, FoundationQuickNavigatorItemProvider>();
            _services.AddTransient <IViewTemplateModelRegistrator, ViewTemplateModelRegistrator>();
            _services.AddSingleton <IHeaderViewModelFactory, HeaderViewModelFactory>();
            _services.AddSingleton <BlogTagFactory>();
            _services.AddSingleton <ISearchService, SearchService>();
            _services.AddSingleton <ISearchViewModelFactory, SearchViewModelFactory>();
            _services.AddSingleton <IModelBinderProvider, FindModelBinderProvider>();
            _services.AddTransient <IContentQuery, LandingPagesSlice>();
            _services.AddTransient <IContentSlice, LandingPagesSlice>();
            _services.AddTransient <IContentQuery, StandardPagesSlice>();
            _services.AddTransient <IContentSlice, StandardPagesSlice>();
            _services.AddTransient <IContentQuery, BlogsSlice>();
            _services.AddTransient <IContentSlice, BlogsSlice>();
            _services.AddTransient <IContentQuery, BlocksSlice>();
            _services.AddTransient <IContentSlice, BlocksSlice>();
            _services.AddTransient <IContentQuery, MediaSlice>();
            _services.AddTransient <IContentSlice, MediaSlice>();
            _services.AddTransient <IContentQuery, ImagesSlice>();
            _services.AddTransient <IContentSlice, ImagesSlice>();
            _services.AddTransient <IContentQuery, EverythingSlice>();
            _services.AddTransient <IContentSlice, EverythingSlice>();
            _services.AddTransient <IContentQuery, MyContentSlice>();
            _services.AddTransient <IContentSlice, MyContentSlice>();
            _services.AddTransient <IContentQuery, MyPagesSlice>();
            _services.AddTransient <IContentSlice, MyPagesSlice>();
            _services.AddTransient <IContentQuery, UnusedMediaSlice>();
            _services.AddTransient <IContentSlice, UnusedMediaSlice>();
            _services.AddTransient <IContentQuery, UnusedBlocksSlice>();
            _services.AddTransient <IContentSlice, UnusedBlocksSlice>();
            _services.AddSingleton <ISchemaDataMapper <BlogItemPage>, BlogItemPageSchemaMapper>();
            _services.AddSingleton <ISchemaDataMapper <HomePage>, HomePageSchemaMapper>();
            _services.AddSingleton <ISchemaDataMapper <LocationItemPage>, LocationItemPageSchemaDataMapper>();
        }
Esempio n. 12
0
 private void ContextOnInitComplete(object sender, EventArgs eventArgs)
 {
     _services.AddTransient <ContentAreaRenderer, FoundationContentAreaRenderer>();
     Extensions.InstallDefaultContent();
     ServiceLocator.Current.GetInstance <ISettingsService>().InitializeSettings();
 }