Class ServiceContext
Represents the Umbraco Service context, which provides access to all services.
Inheritance
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class ServiceContext
Constructors
View SourceServiceContext(Lazy<IPublicAccessService>?, Lazy<IDomainService>?, Lazy<IAuditService>?, Lazy<ILocalizedTextService>?, Lazy<ITagService>?, Lazy<IContentService>?, Lazy<IUserService>?, Lazy<IMemberService>?, Lazy<IMediaService>?, Lazy<IContentTypeService>?, Lazy<IMediaTypeService>?, Lazy<IDataTypeService>?, Lazy<ILanguageService>?, Lazy<IDictionaryItemService>?, Lazy<IPackagingService>?, Lazy<IServerRegistrationService>?, Lazy<IEntityService>?, Lazy<IRelationService>?, Lazy<IMemberTypeService>?, Lazy<IMemberGroupService>?, Lazy<INotificationService>?, Lazy<IExternalLoginWithKeyService>?, Lazy<IRedirectUrlService>?, Lazy<IConsentService>?, Lazy<IKeyValueService>?, Lazy<IContentTypeBaseServiceProvider>?, Lazy<IWebhookService>?, Lazy<ITemplateService>?, Lazy<IPartialViewService>?, Lazy<IStylesheetService>?, Lazy<IScriptService>?)
Initializes a new instance of the ServiceContext class with lazy services.
Declaration
public ServiceContext(Lazy<IPublicAccessService>? publicAccessService, Lazy<IDomainService>? domainService, Lazy<IAuditService>? auditService, Lazy<ILocalizedTextService>? localizedTextService, Lazy<ITagService>? tagService, Lazy<IContentService>? contentService, Lazy<IUserService>? userService, Lazy<IMemberService>? memberService, Lazy<IMediaService>? mediaService, Lazy<IContentTypeService>? contentTypeService, Lazy<IMediaTypeService>? mediaTypeService, Lazy<IDataTypeService>? dataTypeService, Lazy<ILanguageService>? languageService, Lazy<IDictionaryItemService>? dictionaryItemService, Lazy<IPackagingService>? packagingService, Lazy<IServerRegistrationService>? serverRegistrationService, Lazy<IEntityService>? entityService, Lazy<IRelationService>? relationService, Lazy<IMemberTypeService>? memberTypeService, Lazy<IMemberGroupService>? memberGroupService, Lazy<INotificationService>? notificationService, Lazy<IExternalLoginWithKeyService>? externalLoginService, Lazy<IRedirectUrlService>? redirectUrlService, Lazy<IConsentService>? consentService, Lazy<IKeyValueService>? keyValueService, Lazy<IContentTypeBaseServiceProvider>? contentTypeBaseServiceProvider, Lazy<IWebhookService>? webhookService, Lazy<ITemplateService>? templateService, Lazy<IPartialViewService>? partialViewService, Lazy<IStylesheetService>? stylesheetService, Lazy<IScriptService>? scriptService)
Parameters
| Type | Name | Description |
|---|---|---|
| Lazy<IPublicAccessService> | publicAccessService | The public access service. |
| Lazy<IDomainService> | domainService | The domain service. |
| Lazy<IAuditService> | auditService | The audit service. |
| Lazy<ILocalizedTextService> | localizedTextService | The localized text service. |
| Lazy<ITagService> | tagService | The tag service. |
| Lazy<IContentService> | contentService | The content service. |
| Lazy<IUserService> | userService | The user service. |
| Lazy<IMemberService> | memberService | The member service. |
| Lazy<IMediaService> | mediaService | The media service. |
| Lazy<IContentTypeService> | contentTypeService | The content type service. |
| Lazy<IMediaTypeService> | mediaTypeService | The media type service. |
| Lazy<IDataTypeService> | dataTypeService | The data type service. |
| Lazy<ILanguageService> | languageService | The language service. |
| Lazy<IDictionaryItemService> | dictionaryItemService | The dictionary item service. |
| Lazy<IPackagingService> | packagingService | The packaging service. |
| Lazy<IServerRegistrationService> | serverRegistrationService | The server registration service. |
| Lazy<IEntityService> | entityService | The entity service. |
| Lazy<IRelationService> | relationService | The relation service. |
| Lazy<IMemberTypeService> | memberTypeService | The member type service. |
| Lazy<IMemberGroupService> | memberGroupService | The member group service. |
| Lazy<INotificationService> | notificationService | The notification service. |
| Lazy<IExternalLoginWithKeyService> | externalLoginService | The external login service. |
| Lazy<IRedirectUrlService> | redirectUrlService | The redirect URL service. |
| Lazy<IConsentService> | consentService | The consent service. |
| Lazy<IKeyValueService> | keyValueService | The key-value service. |
| Lazy<IContentTypeBaseServiceProvider> | contentTypeBaseServiceProvider | The content type base service provider. |
| Lazy<IWebhookService> | webhookService | The webhook service. |
| Lazy<ITemplateService> | templateService | The template service. |
| Lazy<IPartialViewService> | partialViewService | The partial view service. |
| Lazy<IStylesheetService> | stylesheetService | The stylesheet service. |
| Lazy<IScriptService> | scriptService | The script service. |
Properties
View SourceAuditService
Gets the IAuditService
Declaration
public IAuditService? AuditService { get; }
Property Value
| Type | Description |
|---|---|
| IAuditService |
ConsentService
Gets the ConsentService.
Declaration
public IConsentService? ConsentService { get; }
Property Value
| Type | Description |
|---|---|
| IConsentService |
ContentService
Gets the IContentService
Declaration
public IContentService? ContentService { get; }
Property Value
| Type | Description |
|---|---|
| IContentService |
ContentTypeBaseServices
Gets the ContentTypeServiceBaseFactory.
Declaration
public IContentTypeBaseServiceProvider? ContentTypeBaseServices { get; }
Property Value
| Type | Description |
|---|---|
| IContentTypeBaseServiceProvider |
ContentTypeService
Gets the IContentTypeService
Declaration
public IContentTypeService? ContentTypeService { get; }
Property Value
| Type | Description |
|---|---|
| IContentTypeService |
DataTypeService
Gets the IDataTypeService
Declaration
public IDataTypeService? DataTypeService { get; }
Property Value
| Type | Description |
|---|---|
| IDataTypeService |
DictionaryItemService
Gets the IDictionaryItemService.
Declaration
public IDictionaryItemService? DictionaryItemService { get; }
Property Value
| Type | Description |
|---|---|
| IDictionaryItemService |
DomainService
Gets the IDomainService
Declaration
public IDomainService? DomainService { get; }
Property Value
| Type | Description |
|---|---|
| IDomainService |
EntityService
Gets the IEntityService
Declaration
public IEntityService? EntityService { get; }
Property Value
| Type | Description |
|---|---|
| IEntityService |
ExternalLoginService
Gets the ExternalLoginService.
Declaration
public IExternalLoginWithKeyService? ExternalLoginService { get; }
Property Value
| Type | Description |
|---|---|
| IExternalLoginWithKeyService |
KeyValueService
Gets the KeyValueService.
Declaration
public IKeyValueService? KeyValueService { get; }
Property Value
| Type | Description |
|---|---|
| IKeyValueService |
LanguageService
Gets the ILanguageService.
Declaration
public ILanguageService? LanguageService { get; }
Property Value
| Type | Description |
|---|---|
| ILanguageService |
MediaService
Gets the IMediaService
Declaration
public IMediaService? MediaService { get; }
Property Value
| Type | Description |
|---|---|
| IMediaService |
MediaTypeService
Gets the IMediaTypeService
Declaration
public IMediaTypeService? MediaTypeService { get; }
Property Value
| Type | Description |
|---|---|
| IMediaTypeService |
MemberGroupService
Gets the MemberGroupService
Declaration
public IMemberGroupService? MemberGroupService { get; }
Property Value
| Type | Description |
|---|---|
| IMemberGroupService |
MemberService
Gets the MemberService
Declaration
public IMemberService? MemberService { get; }
Property Value
| Type | Description |
|---|---|
| IMemberService |
MemberTypeService
Gets the MemberTypeService
Declaration
public IMemberTypeService? MemberTypeService { get; }
Property Value
| Type | Description |
|---|---|
| IMemberTypeService |
NotificationService
Gets the INotificationService
Declaration
public INotificationService? NotificationService { get; }
Property Value
| Type | Description |
|---|---|
| INotificationService |
PackagingService
Gets the PackagingService
Declaration
public IPackagingService? PackagingService { get; }
Property Value
| Type | Description |
|---|---|
| IPackagingService |
PartialViewService
Gets the IPartialViewService.
Declaration
public IPartialViewService? PartialViewService { get; }
Property Value
| Type | Description |
|---|---|
| IPartialViewService |
PublicAccessService
Gets the IPublicAccessService
Declaration
public IPublicAccessService? PublicAccessService { get; }
Property Value
| Type | Description |
|---|---|
| IPublicAccessService |
RedirectUrlService
Gets the RedirectUrlService.
Declaration
public IRedirectUrlService? RedirectUrlService { get; }
Property Value
| Type | Description |
|---|---|
| IRedirectUrlService |
RelationService
Gets the IRelationService
Declaration
public IRelationService? RelationService { get; }
Property Value
| Type | Description |
|---|---|
| IRelationService |
ScriptService
Gets the IScriptService.
Declaration
public IScriptService? ScriptService { get; }
Property Value
| Type | Description |
|---|---|
| IScriptService |
ServerRegistrationService
Gets the ServerRegistrationService
Declaration
public IServerRegistrationService? ServerRegistrationService { get; }
Property Value
| Type | Description |
|---|---|
| IServerRegistrationService |
StylesheetService
Gets the IStylesheetService.
Declaration
public IStylesheetService? StylesheetService { get; }
Property Value
| Type | Description |
|---|---|
| IStylesheetService |
TagService
Gets the ITagService
Declaration
public ITagService? TagService { get; }
Property Value
| Type | Description |
|---|---|
| ITagService |
TemplateService
Gets the ITemplateService.
Declaration
public ITemplateService? TemplateService { get; }
Property Value
| Type | Description |
|---|---|
| ITemplateService |
TextService
Gets the ILocalizedTextService
Declaration
public ILocalizedTextService? TextService { get; }
Property Value
| Type | Description |
|---|---|
| ILocalizedTextService |
UserService
Gets the UserService
Declaration
public IUserService? UserService { get; }
Property Value
| Type | Description |
|---|---|
| IUserService |
WebhookService
Gets the WebhookService.
Declaration
public IWebhookService? WebhookService { get; }
Property Value
| Type | Description |
|---|---|
| IWebhookService |
Methods
View SourceCreatePartial(IContentService?, IMediaService?, IContentTypeService?, IMediaTypeService?, IDataTypeService?, ILanguageService?, IDictionaryItemService?, IPackagingService?, IEntityService?, IRelationService?, IMemberGroupService?, IMemberTypeService?, IMemberService?, IUserService?, ITagService?, INotificationService?, ILocalizedTextService?, IAuditService?, IDomainService?, IPublicAccessService?, IExternalLoginWithKeyService?, IServerRegistrationService?, IRedirectUrlService?, IConsentService?, IKeyValueService?, IContentTypeBaseServiceProvider?, IWebhookService?, ITemplateService?, IPartialViewService?, IStylesheetService?, IScriptService?)
Creates a partial service context with only some services (for tests).
Declaration
public static ServiceContext CreatePartial(IContentService? contentService = null, IMediaService? mediaService = null, IContentTypeService? contentTypeService = null, IMediaTypeService? mediaTypeService = null, IDataTypeService? dataTypeService = null, ILanguageService? languageService = null, IDictionaryItemService? dictionaryItemService = null, IPackagingService? packagingService = null, IEntityService? entityService = null, IRelationService? relationService = null, IMemberGroupService? memberGroupService = null, IMemberTypeService? memberTypeService = null, IMemberService? memberService = null, IUserService? userService = null, ITagService? tagService = null, INotificationService? notificationService = null, ILocalizedTextService? localizedTextService = null, IAuditService? auditService = null, IDomainService? domainService = null, IPublicAccessService? publicAccessService = null, IExternalLoginWithKeyService? externalLoginService = null, IServerRegistrationService? serverRegistrationService = null, IRedirectUrlService? redirectUrlService = null, IConsentService? consentService = null, IKeyValueService? keyValueService = null, IContentTypeBaseServiceProvider? contentTypeBaseServiceProvider = null, IWebhookService? webhookService = null, ITemplateService? templateService = null, IPartialViewService? partialViewService = null, IStylesheetService? stylesheetService = null, IScriptService? scriptService = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IContentService | contentService | The content service. |
| IMediaService | mediaService | The media service. |
| IContentTypeService | contentTypeService | The content type service. |
| IMediaTypeService | mediaTypeService | The media type service. |
| IDataTypeService | dataTypeService | The data type service. |
| ILanguageService | languageService | The language service. |
| IDictionaryItemService | dictionaryItemService | The dictionary item service. |
| IPackagingService | packagingService | The packaging service. |
| IEntityService | entityService | The entity service. |
| IRelationService | relationService | The relation service. |
| IMemberGroupService | memberGroupService | The member group service. |
| IMemberTypeService | memberTypeService | The member type service. |
| IMemberService | memberService | The member service. |
| IUserService | userService | The user service. |
| ITagService | tagService | The tag service. |
| INotificationService | notificationService | The notification service. |
| ILocalizedTextService | localizedTextService | The localized text service. |
| IAuditService | auditService | The audit service. |
| IDomainService | domainService | The domain service. |
| IPublicAccessService | publicAccessService | The public access service. |
| IExternalLoginWithKeyService | externalLoginService | The external login service. |
| IServerRegistrationService | serverRegistrationService | The server registration service. |
| IRedirectUrlService | redirectUrlService | The redirect URL service. |
| IConsentService | consentService | The consent service. |
| IKeyValueService | keyValueService | The key-value service. |
| IContentTypeBaseServiceProvider | contentTypeBaseServiceProvider | The content type base service provider. |
| IWebhookService | webhookService | The webhook service. |
| ITemplateService | templateService | The template service. |
| IPartialViewService | partialViewService | The partial view service. |
| IStylesheetService | stylesheetService | The stylesheet service. |
| IScriptService | scriptService | The script service. |
Returns
| Type | Description |
|---|---|
| ServiceContext | A new ServiceContext instance with the specified services. |
Remarks
Using a true constructor for this confuses DI containers.