コード例 #1
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <remarks>
        /// Gets called as part of the EPiServer Framework initialization sequence. Note that it will be called
        /// only once per AppDomain, unless the method throws an exception. If an exception is thrown, the initialization
        /// method will be called repeadetly for each request reaching the site until the method succeeds.
        /// </remarks>
        public void Initialize(InitializationEngine context)
        {
            _contentLoader = ServiceLocator.Current.GetInstance <IContentLoader>();
            //_productIndexingService = ServiceLocator.Current.GetInstance<IProductIndexingService>();
            _contentRepository     = ServiceLocator.Current.GetInstance <IContentRepository>();
            _productService        = ServiceLocator.Current.GetInstance <IProductService>();
            _client                = EpiserverFind.Instance.Create();
            _productListingService = ServiceLocator.Current.GetInstance <IProductListingService>();

            //_client.Conventions.ForInstancesOf<ElectroluxProduct>().ExcludeFieldMatching(x => x.HasMemberAttribute.Equals(nameof(ElectroluxProduct.SeoInformation)));

            var events = context.Locate.ContentEvents();

            //events.PublishedContent += Events_PublishedContent;
            //
            ContentIndexer.Instance.Conventions.ForInstancesOf <FashionProduct>().ShouldIndex(ShouldIndexFashionProduct);
            _client.Conventions.ForInstancesOf <FashionProduct>().IncludeField(p => p.Price);
            _client.Conventions.ForInstancesOf <FashionProduct>().IncludeField(p => p.ListCategories);

            //_client.Conventions.NestedConventions.ForInstancesOf<PartProduct>().Add(p => p.AccessoryCategoryNames);
            //_client.Conventions.ForInstancesOf<PartProduct>().IncludeField(p => p.PartDetailedDescription.ToInternalString());
        }
コード例 #2
0
 public ProductListingController(IProductListingService productListingService)
 {
     _productListingService = productListingService;
 }