コード例 #1
0
 public CustomTextOnlyValueEditor(
     DataEditorAttribute attribute,
     ILocalizedTextService textService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : base(attribute, textService, shortStringHelper, jsonSerializer, ioHelper) => _textService = textService;
コード例 #2
0
 public FileService(
     ICoreScopeProvider uowProvider,
     ILoggerFactory loggerFactory,
     IEventMessagesFactory eventMessagesFactory,
     IStylesheetRepository stylesheetRepository,
     IScriptRepository scriptRepository,
     ITemplateRepository templateRepository,
     IPartialViewRepository partialViewRepository,
     IPartialViewMacroRepository partialViewMacroRepository,
     IAuditRepository auditRepository,
     IShortStringHelper shortStringHelper,
     IOptions <GlobalSettings> globalSettings,
     IHostingEnvironment hostingEnvironment)
     : base(uowProvider, loggerFactory, eventMessagesFactory)
 {
     _stylesheetRepository       = stylesheetRepository;
     _scriptRepository           = scriptRepository;
     _templateRepository         = templateRepository;
     _partialViewRepository      = partialViewRepository;
     _partialViewMacroRepository = partialViewMacroRepository;
     _auditRepository            = auditRepository;
     _shortStringHelper          = shortStringHelper;
     _globalSettings             = globalSettings.Value;
     _hostingEnvironment         = hostingEnvironment;
 }
コード例 #3
0
 public MemberModelBuilderFactory(IMemberTypeService memberTypeService, IMemberService memberService, IShortStringHelper shortStringHelper, IHttpContextAccessor httpContextAccessor)
 {
     _memberTypeService   = memberTypeService;
     _memberService       = memberService;
     _shortStringHelper   = shortStringHelper;
     _httpContextAccessor = httpContextAccessor;
 }
コード例 #4
0
 // used in WebBootManager + tests
 public XmlPublishedSnapshotService(
     ServiceContext serviceContext,
     IPublishedContentTypeFactory publishedContentTypeFactory,
     IScopeProvider scopeProvider,
     IAppCache requestCache,
     IPublishedSnapshotAccessor publishedSnapshotAccessor,
     IVariationContextAccessor variationContextAccessor,
     IUmbracoContextAccessor umbracoContextAccessor,
     IDocumentRepository documentRepository,
     IMediaRepository mediaRepository,
     IMemberRepository memberRepository,
     IDefaultCultureAccessor defaultCultureAccessor,
     ILoggerFactory loggerFactory,
     GlobalSettings globalSettings,
     IHostingEnvironment hostingEnvironment,
     IApplicationShutdownRegistry hostingLifetime,
     IShortStringHelper shortStringHelper,
     IEntityXmlSerializer entitySerializer,
     MainDom mainDom,
     bool testing = false,
     bool enableRepositoryEvents = true)
     : this(serviceContext, publishedContentTypeFactory, scopeProvider, requestCache,
            publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor,
            documentRepository, mediaRepository, memberRepository,
            defaultCultureAccessor,
            loggerFactory, globalSettings, hostingEnvironment, hostingLifetime, shortStringHelper, entitySerializer, null, mainDom, testing, enableRepositoryEvents)
 {
     _umbracoContextAccessor = umbracoContextAccessor;
 }
コード例 #5
0
 public UserGroupValidateFilter(
     IUserService userService,
     IShortStringHelper shortStringHelper)
 {
     _userService       = userService ?? throw new ArgumentNullException(nameof(userService));
     _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
 }
コード例 #6
0
 public MemberType(IShortStringHelper shortStringHelper, IContentTypeComposition parent)
     : this(
         shortStringHelper,
         parent,
         string.Empty)
 {
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IContentTypeCommonRepository"/> class.
 /// </summary>
 public ContentTypeCommonRepository(IScopeAccessor scopeAccessor, ITemplateRepository templateRepository, AppCaches appCaches, IShortStringHelper shortStringHelper)
 {
     _scopeAccessor      = scopeAccessor;
     _templateRepository = templateRepository;
     _appCaches          = appCaches;
     _shortStringHelper  = shortStringHelper;
 }
コード例 #8
0
 public CurrentUserController(
     MediaFileManager mediaFileManager,
     IOptions <ContentSettings> contentSettings,
     IHostingEnvironment hostingEnvironment,
     IImageUrlGenerator imageUrlGenerator,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IUserService userService,
     IUmbracoMapper umbracoMapper,
     IBackOfficeUserManager backOfficeUserManager,
     ILoggerFactory loggerFactory,
     ILocalizedTextService localizedTextService,
     AppCaches appCaches,
     IShortStringHelper shortStringHelper,
     IPasswordChanger <BackOfficeIdentityUser> passwordChanger) : this(
         mediaFileManager,
         StaticServiceProvider.Instance.GetRequiredService <IOptionsSnapshot <ContentSettings> >(),
         hostingEnvironment,
         imageUrlGenerator,
         backofficeSecurityAccessor,
         userService,
         umbracoMapper,
         backOfficeUserManager,
         localizedTextService,
         appCaches,
         shortStringHelper,
         passwordChanger,
         StaticServiceProvider.Instance.GetRequiredService <IUserDataService>())
 {
 }
コード例 #9
0
    /// <summary>
    ///     Gets the URL segment for a specified content and culture.
    /// </summary>
    /// <param name="content">The content.</param>
    /// <param name="shortStringHelper"></param>
    /// <param name="urlSegmentProviders"></param>
    /// <param name="culture">The culture.</param>
    /// <returns>The URL segment.</returns>
    public static string?GetUrlSegment(this IContentBase content, IShortStringHelper shortStringHelper, IEnumerable <IUrlSegmentProvider> urlSegmentProviders, string?culture = null)
    {
        if (content == null)
        {
            throw new ArgumentNullException(nameof(content));
        }

        if (urlSegmentProviders == null)
        {
            throw new ArgumentNullException(nameof(urlSegmentProviders));
        }

        var url = urlSegmentProviders.Select(p => p.GetUrlSegment(content, culture)).FirstOrDefault(u => u != null);

        if (url == null)
        {
            if (_defaultUrlSegmentProvider == null)
            {
                _defaultUrlSegmentProvider = new DefaultUrlSegmentProvider(shortStringHelper);
            }

            url = _defaultUrlSegmentProvider.GetUrlSegment(content, culture); // be safe
        }

        return(url);
    }
コード例 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataValueEditor"/> class.
        /// </summary>
        public DataValueEditor(
            ILocalizedTextService localizedTextService,
            IShortStringHelper shortStringHelper,
            IJsonSerializer jsonSerializer,
            IIOHelper ioHelper,
            DataEditorAttribute attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }
            _localizedTextService = localizedTextService;
            _shortStringHelper    = shortStringHelper;
            _jsonSerializer       = jsonSerializer;

            var view = attribute.View;

            if (string.IsNullOrWhiteSpace(view))
            {
                throw new ArgumentException("The attribute does not specify a view.", nameof(attribute));
            }

            if (view.StartsWith("~/"))
            {
                view = ioHelper.ResolveRelativeOrVirtualUrl(view);
            }

            View      = view;
            ValueType = attribute.ValueType;
            HideLabel = attribute.HideLabel;
        }
コード例 #11
0
 public DateValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute) =>
コード例 #12
0
 public CreateVendrCheckoutDocumentTypesTask(IContentTypeService contentTypeService, IDataTypeService dataTypeService,
                                             IShortStringHelper shortStringHelper)
 {
     _contentTypeService = contentTypeService;
     _dataTypeService    = dataTypeService;
     _shortStringHelper  = shortStringHelper;
 }
コード例 #13
0
    public ContentTypeMapDefinition(
        CommonMapper commonMapper,
        PropertyEditorCollection propertyEditors,
        IDataTypeService dataTypeService,
        IFileService fileService,
        IContentTypeService contentTypeService,
        IMediaTypeService mediaTypeService,
        IMemberTypeService memberTypeService,
        ILoggerFactory loggerFactory,
        IShortStringHelper shortStringHelper,
        IOptions <GlobalSettings> globalSettings,
        IHostingEnvironment hostingEnvironment,
        IOptionsMonitor <ContentSettings> contentSettings)
    {
        _commonMapper       = commonMapper;
        _propertyEditors    = propertyEditors;
        _dataTypeService    = dataTypeService;
        _fileService        = fileService;
        _contentTypeService = contentTypeService;
        _mediaTypeService   = mediaTypeService;
        _memberTypeService  = memberTypeService;
        _loggerFactory      = loggerFactory;
        _logger             = _loggerFactory.CreateLogger <ContentTypeMapDefinition>();
        _shortStringHelper  = shortStringHelper;
        _globalSettings     = globalSettings.Value;
        _hostingEnvironment = hostingEnvironment;

        _contentSettings = contentSettings.CurrentValue;
        contentSettings.OnChange(x => _contentSettings = x);
    }
コード例 #14
0
 public ContentTypeMapDefinition(
     CommonMapper commonMapper,
     PropertyEditorCollection propertyEditors,
     IDataTypeService dataTypeService,
     IFileService fileService,
     IContentTypeService contentTypeService,
     IMediaTypeService mediaTypeService,
     IMemberTypeService memberTypeService,
     ILoggerFactory loggerFactory,
     IShortStringHelper shortStringHelper,
     IOptions <GlobalSettings> globalSettings,
     IHostingEnvironment hostingEnvironment)
     : this(
         commonMapper,
         propertyEditors,
         dataTypeService,
         fileService,
         contentTypeService,
         mediaTypeService,
         memberTypeService,
         loggerFactory,
         shortStringHelper,
         globalSettings,
         hostingEnvironment,
         StaticServiceProvider.Instance.GetRequiredService <IOptionsMonitor <ContentSettings> >())
 {
 }
コード例 #15
0
 /// <summary>
 /// Constructor to create a new user group
 /// </summary>
 public UserGroup(IShortStringHelper shortStringHelper)
 {
     _alias             = string.Empty;
     _name              = string.Empty;
     _shortStringHelper = shortStringHelper;
     _sectionCollection = new List <string>();
 }
コード例 #16
0
 public CurrentUserController(
     MediaFileManager mediaFileManager,
     IOptionsSnapshot <ContentSettings> contentSettings,
     IHostingEnvironment hostingEnvironment,
     IImageUrlGenerator imageUrlGenerator,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IUserService userService,
     IUmbracoMapper umbracoMapper,
     IBackOfficeUserManager backOfficeUserManager,
     ILocalizedTextService localizedTextService,
     AppCaches appCaches,
     IShortStringHelper shortStringHelper,
     IPasswordChanger <BackOfficeIdentityUser> passwordChanger,
     IUserDataService userDataService)
 {
     _mediaFileManager           = mediaFileManager;
     _contentSettings            = contentSettings.Value;
     _hostingEnvironment         = hostingEnvironment;
     _imageUrlGenerator          = imageUrlGenerator;
     _backofficeSecurityAccessor = backofficeSecurityAccessor;
     _userService           = userService;
     _umbracoMapper         = umbracoMapper;
     _backOfficeUserManager = backOfficeUserManager;
     _localizedTextService  = localizedTextService;
     _appCaches             = appCaches;
     _shortStringHelper     = shortStringHelper;
     _passwordChanger       = passwordChanger;
     _userDataService       = userDataService;
 }
コード例 #17
0
        public static Template BuildEntity(IShortStringHelper shortStringHelper, TemplateDto dto, IEnumerable <IUmbracoEntity> childDefinitions, Func <File, string?> getFileContent)
        {
            var template = new Template(shortStringHelper, dto.NodeDto.Text, dto.Alias, getFileContent);

            try
            {
                template.DisableChangeTracking();

                template.CreateDate = dto.NodeDto.CreateDate;
                template.Id         = dto.NodeId;
                template.Key        = dto.NodeDto.UniqueId;
                template.Path       = dto.NodeDto.Path;

                template.IsMasterTemplate = childDefinitions.Any(x => x.ParentId == dto.NodeId);

                if (dto.NodeDto.ParentId > 0)
                {
                    template.MasterTemplateId = new Lazy <int>(() => dto.NodeDto.ParentId);
                }

                // reset dirty initial properties (U4-1946)
                template.ResetDirtyProperties(false);
                return(template);
            }
            finally
            {
                template.EnableChangeTracking();
            }
        }
コード例 #18
0
        /// <summary>
        /// Sets the posted file value of a property.
        /// </summary>
        public static void SetValue(
            this IContentBase content,
            MediaFileManager mediaFileManager,
            MediaUrlGeneratorCollection mediaUrlGenerators,
            IShortStringHelper shortStringHelper,
            IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
            string propertyTypeAlias,
            string filename,
            Stream filestream,
            string culture = null,
            string segment = null)
        {
            if (filename == null || filestream == null)
            {
                return;
            }

            filename = shortStringHelper.CleanStringForSafeFileName(filename);
            if (string.IsNullOrWhiteSpace(filename))
            {
                return;
            }
            filename = filename.ToLower();

            SetUploadFile(content, mediaFileManager, mediaUrlGenerators, contentTypeBaseServiceProvider, propertyTypeAlias, filename, filestream, culture, segment);
        }
コード例 #19
0
 /// <summary>
 ///     Creates an item with pre-filled properties
 /// </summary>
 /// <param name="id"></param>
 /// <param name="key"></param>
 /// <param name="useInEditor"></param>
 /// <param name="cacheDuration"></param>
 /// <param name="alias"></param>
 /// <param name="name"></param>
 /// <param name="cacheByPage"></param>
 /// <param name="cacheByMember"></param>
 /// <param name="dontRender"></param>
 /// <param name="macroSource"></param>
 /// <param name="shortStringHelper"></param>
 public Macro(
     IShortStringHelper shortStringHelper,
     int id,
     Guid key,
     bool useInEditor,
     int cacheDuration,
     string alias,
     string?name,
     bool cacheByPage,
     bool cacheByMember,
     bool dontRender,
     string macroSource)
     : this(shortStringHelper)
 {
     Id            = id;
     Key           = key;
     UseInEditor   = useInEditor;
     CacheDuration = cacheDuration;
     Alias         = alias.ToCleanString(shortStringHelper, CleanStringType.Alias);
     Name          = name;
     CacheByPage   = cacheByPage;
     CacheByMember = cacheByMember;
     DontRender    = dontRender;
     MacroSource   = macroSource;
 }
コード例 #20
0
    public static IUserGroup BuildEntity(IShortStringHelper shortStringHelper, UserGroupDto dto)
    {
        var userGroup = new UserGroup(
            shortStringHelper,
            dto.UserCount,
            dto.Alias,
            dto.Name,
            dto.DefaultPermissions.IsNullOrWhiteSpace() ? Enumerable.Empty <string>() : dto.DefaultPermissions !.ToCharArray().Select(x => x.ToString(CultureInfo.InvariantCulture)).ToList(),
            dto.Icon);

        try
        {
            userGroup.DisableChangeTracking();
            userGroup.Id             = dto.Id;
            userGroup.CreateDate     = dto.CreateDate;
            userGroup.UpdateDate     = dto.UpdateDate;
            userGroup.StartContentId = dto.StartContentId;
            userGroup.StartMediaId   = dto.StartMediaId;
            if (dto.UserGroup2AppDtos != null)
            {
                foreach (UserGroup2AppDto app in dto.UserGroup2AppDtos)
                {
                    userGroup.AddAllowedSection(app.AppAlias);
                }
            }

            userGroup.ResetDirtyProperties(false);
            return(userGroup);
        }
        finally
        {
            userGroup.EnableChangeTracking();
        }
    }
コード例 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemberController"/> class.
 /// </summary>
 /// <param name="cultureDictionary">The culture dictionary</param>
 /// <param name="loggerFactory">The logger factory</param>
 /// <param name="shortStringHelper">The string helper</param>
 /// <param name="eventMessages">The event messages factory</param>
 /// <param name="localizedTextService">The entry point for localizing key services</param>
 /// <param name="propertyEditors">The property editors</param>
 /// <param name="umbracoMapper">The mapper</param>
 /// <param name="memberService">The member service</param>
 /// <param name="memberTypeService">The member type service</param>
 /// <param name="memberManager">The member manager</param>
 /// <param name="dataTypeService">The data-type service</param>
 /// <param name="backOfficeSecurityAccessor">The back office security accessor</param>
 /// <param name="jsonSerializer">The JSON serializer</param>
 /// <param name="passwordChanger">The password changer</param>
 public MemberController(
     ICultureDictionary cultureDictionary,
     ILoggerFactory loggerFactory,
     IShortStringHelper shortStringHelper,
     IEventMessagesFactory eventMessages,
     ILocalizedTextService localizedTextService,
     PropertyEditorCollection propertyEditors,
     IUmbracoMapper umbracoMapper,
     IMemberService memberService,
     IMemberTypeService memberTypeService,
     IMemberManager memberManager,
     IDataTypeService dataTypeService,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     IJsonSerializer jsonSerializer,
     IPasswordChanger <MemberIdentityUser> passwordChanger,
     ICoreScopeProvider scopeProvider)
     : base(cultureDictionary, loggerFactory, shortStringHelper, eventMessages, localizedTextService, jsonSerializer)
 {
     _propertyEditors            = propertyEditors;
     _umbracoMapper              = umbracoMapper;
     _memberService              = memberService;
     _memberTypeService          = memberTypeService;
     _memberManager              = memberManager;
     _dataTypeService            = dataTypeService;
     _localizedTextService       = localizedTextService;
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
     _jsonSerializer             = jsonSerializer;
     _shortStringHelper          = shortStringHelper;
     _passwordChanger            = passwordChanger;
     _scopeProvider              = scopeProvider;
 }
コード例 #22
0
 public PropertyTypeGroupMapper(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IShortStringHelper shortStringHelper, ILogger <PropertyTypeGroupMapper <TPropertyType> > logger)
 {
     _propertyEditors   = propertyEditors;
     _dataTypeService   = dataTypeService;
     _shortStringHelper = shortStringHelper;
     _logger            = logger;
 }
コード例 #23
0
    /// <summary>
    ///     Initializes a new instance of the <see cref="ManifestParser" /> class.
    /// </summary>
    public ManifestParser(
        AppCaches appCaches,
        ManifestValueValidatorCollection validators,
        ManifestFilterCollection filters,
        ILogger <ManifestParser> logger,
        IIOHelper ioHelper,
        IHostingEnvironment hostingEnvironment,
        IJsonSerializer jsonSerializer,
        ILocalizedTextService localizedTextService,
        IShortStringHelper shortStringHelper,
        IDataValueEditorFactory dataValueEditorFactory)
    {
        if (appCaches == null)
        {
            throw new ArgumentNullException(nameof(appCaches));
        }

        _cache                  = appCaches.RuntimeCache;
        _validators             = validators ?? throw new ArgumentNullException(nameof(validators));
        _filters                = filters ?? throw new ArgumentNullException(nameof(filters));
        _logger                 = logger ?? throw new ArgumentNullException(nameof(logger));
        _ioHelper               = ioHelper;
        _hostingEnvironment     = hostingEnvironment;
        AppPluginsPath          = "~/App_Plugins";
        _jsonSerializer         = jsonSerializer;
        _localizedTextService   = localizedTextService;
        _shortStringHelper      = shortStringHelper;
        _dataValueEditorFactory = dataValueEditorFactory;
    }
コード例 #24
0
 public GridPropertyValueEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     DataEditorAttribute attribute,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     ILocalizedTextService localizedTextService,
     HtmlImageSourceParser imageSourceParser,
     RichTextEditorPastedImages pastedImages,
     IShortStringHelper shortStringHelper,
     IImageUrlGenerator imageUrlGenerator,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : this(
         dataValueEditorFactory,
         attribute,
         backOfficeSecurityAccessor,
         localizedTextService,
         imageSourceParser,
         pastedImages,
         shortStringHelper,
         imageUrlGenerator,
         jsonSerializer,
         ioHelper,
         StaticServiceProvider.Instance.GetRequiredService <IHtmlMacroParameterParser>())
 {
 }
コード例 #25
0
 public DataTypeService(
     IDataValueEditorFactory dataValueEditorFactory,
     ICoreScopeProvider provider,
     ILoggerFactory loggerFactory,
     IEventMessagesFactory eventMessagesFactory,
     IDataTypeRepository dataTypeRepository,
     IDataTypeContainerRepository dataTypeContainerRepository,
     IAuditRepository auditRepository,
     IEntityRepository entityRepository,
     IContentTypeRepository contentTypeRepository,
     IIOHelper ioHelper,
     ILocalizedTextService localizedTextService,
     ILocalizationService localizationService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IEditorConfigurationParser editorConfigurationParser)
     : base(provider, loggerFactory, eventMessagesFactory)
 {
     _dataValueEditorFactory      = dataValueEditorFactory;
     _dataTypeRepository          = dataTypeRepository;
     _dataTypeContainerRepository = dataTypeContainerRepository;
     _auditRepository             = auditRepository;
     _entityRepository            = entityRepository;
     _contentTypeRepository       = contentTypeRepository;
     _ioHelper                  = ioHelper;
     _localizedTextService      = localizedTextService;
     _localizationService       = localizationService;
     _shortStringHelper         = shortStringHelper;
     _jsonSerializer            = jsonSerializer;
     _editorConfigurationParser = editorConfigurationParser;
 }
コード例 #26
0
 public MemberTypeController(
     ICultureDictionary cultureDictionary,
     EditorValidatorCollection editorValidatorCollection,
     IContentTypeService contentTypeService,
     IMediaTypeService mediaTypeService,
     IMemberTypeService memberTypeService,
     IUmbracoMapper umbracoMapper,
     ILocalizedTextService localizedTextService,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IShortStringHelper shortStringHelper)
     : base(cultureDictionary,
            editorValidatorCollection,
            contentTypeService,
            mediaTypeService,
            memberTypeService,
            umbracoMapper,
            localizedTextService)
 {
     _memberTypeService          = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
     _backofficeSecurityAccessor = backofficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backofficeSecurityAccessor));
     _shortStringHelper          = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
     _umbracoMapper        = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
     _localizedTextService =
         localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
 }
コード例 #27
0
    /// <summary>
    ///     Initializes a new instance of the <see cref="UmbracoRouteValuesFactory" /> class.
    /// </summary>
    public UmbracoRouteValuesFactory(
        IOptions <UmbracoRenderingDefaultsOptions> renderingDefaults,
        IShortStringHelper shortStringHelper,
        UmbracoFeatures umbracoFeatures,
        IControllerActionSearcher controllerActionSearcher,
        IPublishedRouter publishedRouter)
    {
        _shortStringHelper        = shortStringHelper;
        _umbracoFeatures          = umbracoFeatures;
        _controllerActionSearcher = controllerActionSearcher;
        _publishedRouter          = publishedRouter;
        _defaultControllerName    = new Lazy <string>(() =>
                                                      ControllerExtensions.GetControllerName(renderingDefaults.Value.DefaultControllerType));
        _defaultControllerDescriptor = new Lazy <ControllerActionDescriptor>(() =>
        {
            ControllerActionDescriptor?descriptor = _controllerActionSearcher.Find <IRenderController>(
                new DefaultHttpContext(), // this actually makes no difference for this method
                DefaultControllerName,
                UmbracoRouteValues.DefaultActionName);

            if (descriptor == null)
            {
                throw new InvalidOperationException(
                    $"No controller/action found by name {DefaultControllerName}.{UmbracoRouteValues.DefaultActionName}");
            }

            return(descriptor);
        });
    }
コード例 #28
0
 public TemplateController(
     IFileService fileService,
     IUmbracoMapper umbracoMapper,
     IShortStringHelper shortStringHelper)
     : this(fileService, umbracoMapper, shortStringHelper, StaticServiceProvider.Instance.GetRequiredService <IDefaultViewContentProvider>())
 {
 }
コード例 #29
0
 public UserGroupRepository(IScopeAccessor scopeAccessor, AppCaches appCaches, ILogger <UserGroupRepository> logger, ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper)
     : base(scopeAccessor, appCaches, logger)
 {
     _shortStringHelper            = shortStringHelper;
     _userGroupWithUsersRepository = new UserGroupWithUsersRepository(this, scopeAccessor, appCaches, loggerFactory.CreateLogger <UserGroupWithUsersRepository>());
     _permissionRepository         = new PermissionRepository <IContent>(scopeAccessor, appCaches, loggerFactory.CreateLogger <PermissionRepository <IContent> >());
 }
コード例 #30
0
 public Template(IShortStringHelper shortStringHelper, string?name, string?alias, Func <File, string?>?getFileContent)
     : base(string.Empty, getFileContent)
 {
     _shortStringHelper = shortStringHelper;
     _name             = name;
     _alias            = alias?.ToCleanString(shortStringHelper, CleanStringType.UnderscoreAlias) ?? string.Empty;
     _masterTemplateId = new Lazy <int>(() => - 1);
 }