Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerRegistrationService"/> class.
 /// </summary>
 /// <param name="uowProvider">A UnitOfWork provider.</param>
 /// <param name="repositoryFactory">A repository factory.</param>
 /// <param name="logger">A logger.</param>
 /// <param name="eventMessagesFactory"></param>
 public ServerRegistrationService(IScopeUnitOfWorkProvider uowProvider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
     : base(uowProvider, repositoryFactory, logger, eventMessagesFactory)
 {
     _lrepo = new LockingRepository <IServerRegistrationRepository>(UowProvider,
                                                                    x => RepositoryFactory.CreateServerRegistrationRepository(x),
                                                                    LockingRepositoryIds, LockingRepositoryIds);
 }
Ejemplo n.º 2
0
        public LockingRepository(IScopeUnitOfWorkProvider uowProvider, Func <IScopeUnitOfWork, TRepository> repositoryFactory,
                                 IEnumerable <int> readLockIds, IEnumerable <int> writeLockIds)
        {
            Mandate.ParameterNotNull(uowProvider, "uowProvider");
            Mandate.ParameterNotNull(repositoryFactory, "repositoryFactory");

            _uowProvider       = uowProvider;
            _repositoryFactory = repositoryFactory;
            _readLockIds       = readLockIds == null ? new int[0] : readLockIds.ToArray();
            _writeLockIds      = writeLockIds == null ? new int[0] : writeLockIds.ToArray();
        }
        public SectionService(
            IUserService userService,
            IApplicationTreeService applicationTreeService,
            IScopeUnitOfWorkProvider uowProvider,
            CacheHelper cache)
        {
            if (applicationTreeService == null)
            {
                throw new ArgumentNullException("applicationTreeService");
            }
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }

            _userService            = userService;
            _applicationTreeService = applicationTreeService;
            _uowProvider            = uowProvider;
            _cache = cache;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a service context with a RepositoryFactory which is used to construct Services
        /// </summary>
        /// <param name="repositoryFactory"></param>
        /// <param name="provider"></param>
        /// <param name="cache"></param>
        /// <param name="logger"></param>
        /// <param name="eventMessagesFactory"></param>
        public ServiceContext(
            RepositoryFactory repositoryFactory,
            IScopeUnitOfWorkProvider provider,
            CacheHelper cache,
            ILogger logger,
            IEventMessagesFactory eventMessagesFactory)
        {
            if (repositoryFactory == null)
            {
                throw new ArgumentNullException("repositoryFactory");
            }
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (eventMessagesFactory == null)
            {
                throw new ArgumentNullException("eventMessagesFactory");
            }

            EventMessagesFactory = eventMessagesFactory;

            IdkMap = new IdkMap(provider);

            BuildServiceCache(provider, cache,
                              repositoryFactory,
                              logger, eventMessagesFactory, IdkMap);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContentService"/> class.
 /// </summary>
 public ConsentService(IScopeUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
     : base(provider, repositoryFactory, logger, eventMessagesFactory)
 {
 }
Ejemplo n.º 6
0
 protected ScopeRepositoryService(IScopeUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
     : base(provider, repositoryFactory, logger, eventMessagesFactory)
 {
     UowProvider = provider;
 }
 //private
 public MemberExtendedService(IScopeUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IMemberGroupService memberGroupService, IDataTypeService dataTypeService)
     : base(provider, repositoryFactory, logger, eventMessagesFactory, memberGroupService, dataTypeService)
 {
     UowProvider = provider;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Builds the various services
        /// </summary>
        private void BuildServiceCache(
            IScopeUnitOfWorkProvider provider,
            CacheHelper cache,
            RepositoryFactory repositoryFactory,
            ILogger logger,
            IEventMessagesFactory eventMessagesFactory,
            IdkMap idkMap)
        {
            EventMessagesFactory = eventMessagesFactory;

            if (_migrationEntryService == null)
            {
                _migrationEntryService = new Lazy <IMigrationEntryService>(() => new MigrationEntryService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_externalLoginService == null)
            {
                _externalLoginService = new Lazy <IExternalLoginService>(() => new ExternalLoginService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_publicAccessService == null)
            {
                _publicAccessService = new Lazy <IPublicAccessService>(() => new PublicAccessService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_taskService == null)
            {
                _taskService = new Lazy <ITaskService>(() => new TaskService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_domainService == null)
            {
                _domainService = new Lazy <IDomainService>(() => new DomainService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_auditService == null)
            {
                _auditService = new Lazy <IAuditService>(() => new AuditService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_localizedTextService == null)
            {
                _localizedTextService = new Lazy <ILocalizedTextService>(() => new LocalizedTextService(
                                                                             new Lazy <LocalizedTextServiceFileSources>(() =>
                {
                    var mainLangFolder   = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/"));
                    var appPlugins       = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.AppPlugins));
                    var configLangFolder = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Config + "/lang/"));

                    var pluginLangFolders = appPlugins.Exists == false
                            ? Enumerable.Empty <LocalizedTextServiceSupplementaryFileSource>()
                            : appPlugins.GetDirectories()
                                            .SelectMany(x => x.GetDirectories("Lang"))
                                            .SelectMany(x => x.GetFiles("*.xml", SearchOption.TopDirectoryOnly))
                                            .Where(x => Path.GetFileNameWithoutExtension(x.FullName).Length == 5)
                                            .Select(x => new LocalizedTextServiceSupplementaryFileSource(x, false));

                    //user defined langs that overwrite the default, these should not be used by plugin creators
                    var userLangFolders = configLangFolder.Exists == false
                            ? Enumerable.Empty <LocalizedTextServiceSupplementaryFileSource>()
                            : configLangFolder
                                          .GetFiles("*.user.xml", SearchOption.TopDirectoryOnly)
                                          .Where(x => Path.GetFileNameWithoutExtension(x.FullName).Length == 10)
                                          .Select(x => new LocalizedTextServiceSupplementaryFileSource(x, true));

                    return(new LocalizedTextServiceFileSources(
                               logger,
                               cache.RuntimeCache,
                               mainLangFolder,
                               pluginLangFolders.Concat(userLangFolders)));
                }),
                                                                             logger));
            }


            if (_notificationService == null)
            {
                _notificationService = new Lazy <INotificationService>(() => new NotificationService(provider, _userService.Value, _contentService.Value, logger));
            }

            if (_serverRegistrationService == null)
            {
                _serverRegistrationService = new Lazy <IServerRegistrationService>(() => new ServerRegistrationService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_userService == null)
            {
                _userService = new Lazy <IUserService>(() => new UserService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_memberService == null)
            {
                _memberService = new Lazy <IMemberService>(() => new MemberService(provider, repositoryFactory, logger, eventMessagesFactory, _memberGroupService.Value, _dataTypeService.Value));
            }

            if (_contentService == null)
            {
                _contentService = new Lazy <IContentService>(() => new ContentService(provider, repositoryFactory, logger, eventMessagesFactory, _dataTypeService.Value, _userService.Value));
            }

            if (_mediaService == null)
            {
                _mediaService = new Lazy <IMediaService>(() => new MediaService(provider, repositoryFactory, logger, eventMessagesFactory, _dataTypeService.Value, _userService.Value));
            }

            if (_contentTypeService == null)
            {
                _contentTypeService = new Lazy <IContentTypeService>(() => new ContentTypeService(provider, repositoryFactory, logger, eventMessagesFactory, _contentService.Value, _mediaService.Value));
            }

            if (_dataTypeService == null)
            {
                _dataTypeService = new Lazy <IDataTypeService>(() => new DataTypeService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_fileService == null)
            {
                _fileService = new Lazy <IFileService>(() => new FileService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_localizationService == null)
            {
                _localizationService = new Lazy <ILocalizationService>(() => new LocalizationService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_entityService == null)
            {
                _entityService = new Lazy <IEntityService>(() => new EntityService(
                                                               provider, repositoryFactory, logger, eventMessagesFactory,
                                                               _contentService.Value, _contentTypeService.Value, _mediaService.Value, _dataTypeService.Value, _memberService.Value, _memberTypeService.Value,
                                                               idkMap));
            }

            if (_packagingService == null)
            {
                _packagingService = new Lazy <IPackagingService>(() => new PackagingService(logger, _contentService.Value, _contentTypeService.Value, _mediaService.Value, _macroService.Value, _dataTypeService.Value, _fileService.Value, _localizationService.Value, _entityService.Value, _userService.Value, repositoryFactory, provider));
            }

            if (_relationService == null)
            {
                _relationService = new Lazy <IRelationService>(() => new RelationService(provider, repositoryFactory, logger, eventMessagesFactory, _entityService.Value));
            }

            if (_treeService == null)
            {
                _treeService = new Lazy <IApplicationTreeService>(() => new ApplicationTreeService(logger, cache));
            }

            if (_sectionService == null)
            {
                _sectionService = new Lazy <ISectionService>(() => new SectionService(_userService.Value, _treeService.Value, provider, cache));
            }

            if (_macroService == null)
            {
                _macroService = new Lazy <IMacroService>(() => new MacroService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_memberTypeService == null)
            {
                _memberTypeService = new Lazy <IMemberTypeService>(() => new MemberTypeService(provider, repositoryFactory, logger, eventMessagesFactory, _memberService.Value));
            }

            if (_tagService == null)
            {
                _tagService = new Lazy <ITagService>(() => new TagService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_memberGroupService == null)
            {
                _memberGroupService = new Lazy <IMemberGroupService>(() => new MemberGroupService(provider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_redirectUrlService == null)
            {
                _redirectUrlService = new Lazy <IRedirectUrlService>(() => new RedirectUrlService(provider, repositoryFactory, logger, eventMessagesFactory));
            }
        }