Пример #1
0
        private CatalogServicesDecorator CreateCatalogServicesDecorator(CacheManagerAdaptor cacheManagerAdaptor)
        {
            if (_container.IsRegistered <IItemService>() &&
                _container.IsRegistered <ICatalogSearchService>() &&
                _container.IsRegistered <IPropertyService>() &&
                _container.IsRegistered <ICategoryService>() &&
                _container.IsRegistered <ICatalogService>())
            {
                var catalogServicesDecorator = new CatalogServicesDecorator(_container.Resolve <IItemService>(), _container.Resolve <ICatalogSearchService>(), _container.Resolve <IPropertyService>(), _container.Resolve <ICategoryService>(), _container.Resolve <ICatalogService>(), cacheManagerAdaptor);
                _container.RegisterInstance <IItemService>(catalogServicesDecorator);
                _container.RegisterInstance <ICatalogSearchService>(catalogServicesDecorator);
                _container.RegisterInstance <IPropertyService>(catalogServicesDecorator);
                _container.RegisterInstance <ICategoryService>(catalogServicesDecorator);
                _container.RegisterInstance <ICatalogService>(catalogServicesDecorator);
                return(catalogServicesDecorator);
            }

            return(null);
        }
Пример #2
0
 private void CreateCommerceServiceDecorator(StoreServicesDecorator storeServiceDecorator, CatalogServicesDecorator catalogServicesDecorator)
 {
     if (_container.IsRegistered <ICommerceService>())
     {
         var commerceServicesDecorator = new CommerceServiceDecorator(_container.Resolve <ICommerceService>(), new ICachedServiceDecorator[] { catalogServicesDecorator, storeServiceDecorator });
         _container.RegisterInstance <ICommerceService>(commerceServicesDecorator);
     }
 }