public TagService(IRepository <TagRecord> tagRepository,
                          IRepository <ContentTagRecord> contentTagRepository,
                          INotifier notifier,
                          IAuthorizationService authorizationService,
                          IOrchardServices orchardServices,
                          ISessionFactoryHolder sessionFactoryHolder,
                          ILockingProvider lockingProvider)
        {
            _tagRepository        = tagRepository;
            _contentTagRepository = contentTagRepository;
            _notifier             = notifier;
            _authorizationService = authorizationService;
            _orchardServices      = orchardServices;
            _sessionFactoryHolder = sessionFactoryHolder;
            _lockingProvider      = lockingProvider;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;
        }
Exemplo n.º 2
0
        public AutoroutePartHandler(
            IRepository <AutoroutePartRecord> autoroutePartRepository,
            Lazy <IAutorouteService> autorouteService,
            IContentManager contentManager,
            IOrchardServices orchardServices,
            IHomeAliasService homeAliasService,
            ILockingProvider lockingProvider)
        {
            Filters.Add(StorageFilter.For(autoroutePartRepository));
            _autorouteService = autorouteService;
            _contentManager   = contentManager;
            _orchardServices  = orchardServices;
            _homeAliasService = homeAliasService;
            _lockingProvider  = lockingProvider;

            OnUpdated <AutoroutePart>((ctx, part) => CreateAlias(part));

            OnCreated <AutoroutePart>((ctx, part) => {
                // non-draftable items
                if (part.ContentItem.VersionRecord == null)
                {
                    PublishAlias(part);
                }
            });

            OnPublished <AutoroutePart>((ctx, part) => PublishAlias(part));

            // Remove alias if destroyed, removed or unpublished
            OnRemoving <AutoroutePart>((ctx, part) => RemoveAlias(part));
            OnDestroying <AutoroutePart>((ctx, part) => RemoveAlias(part));
            OnUnpublishing <AutoroutePart>((ctx, part) => RemoveAlias(part));

            // Register alias as identity
            OnGetContentItemMetadata <AutoroutePart>((ctx, part) => {
                if (part.DisplayAlias != null)
                {
                    ctx.Metadata.Identity.Add("alias", part.DisplayAlias);
                }
            });
        }