Namespace ToSic.Sxc.Services
The Services are the most common helpers / tools used in Razor and WebAPI C#.
Quick Use with @Kit.SomeServiceName
Most services are available on the Kit
object on your Razor or WebApi file.
This requires the use of v14 base classes, such as Razor14
.
Manual Use with GetService<T>
You will usually get a service using the GetService<T>()
method like this:
@using ToSic.Sxc.Services;
@{
var pageSvc = Sxc.GetService<IPageService>();
}
Read more about GetService<T>() or about GetService<T> in general.
To use GetService in a DNN Theme/Skin/Module, check out GetScopedService<T>() and read it in the release blog.
Namespaces
Classes
- DnnExtensions
Provides extension methods for DNN Skins (Themes) and Modules. It only exists on the Dnn platform, not on Oqtane.
- ServiceKit14
Default ServiceKit for 2sxc v14. Provided in Razor and WebApi as
Kit
.
- ServiceKit16
Default ServiceKit for 2sxc v16. Provided in Razor and WebApi as
Kit
.
- ServiceKitLight16
Lightweight ServiceKit for 2sxc v16. Provided in custom data sources as
Kit
.
Interfaces
- IAdamService
Internal: Adam Service for ADAM operations such as retrieving a single file.
- ICacheService
Service on
Kit.Cache
to help your code cache data.
- IConvertService
Conversion helper for things which are very common in web-code like Razor and WebAPIs.
- IConvertService16
Helper on
Kit.Convert
for common conversions in web-code like Razor and WebAPIs.
- IDataService
Services on
Kit.Data
to create DataSources in Razor.
- IDynamicCodeService
This is a service to give you DynamicCode outside 2sxc.
- IEditService
Service on
Kit.Edit
with status and commands to configure the in-page editing system.
- IFeaturesService
Service on
Kit.Feature
to let your code find out what system features are currently enabled/disabled in the environment.
- IImageService
Service on
Kit.Image
to help create responsiveimg
andpicture
tags the best possible way.
- IJsonService
Service on
Kit.Json
to serialize/restore JSON.
- IKeyService
Service on
Kit.Key
to generate module/block level unique keys.
- ILinkService
Helper on
Kit.Link
to create links to pages, APIs and images.
- IMailService
Service on
Kit.Mail
to send mail messages cross-platform.
- IPageService
Service on
Kit.Page
to make changes to the page - usually from Razor.
- IRenderService
Service on
Kit.Render
to rendering blocks and delivering HTML for the output.
- ISecureDataService
Service on
Kit.SecureData
to work with secure / encrypted data.
- ISystemLogService
Service on
Kit.SystemLog
to add messages to the global (system) log in any platform Dnn/Oqtane.
- ITemplateService
Service on
Kit.Template
to help parse token-based templates.
- IToolbarService
Service on
Kit.Toolbar
to generate edit toolbars in the front-end.
- IUserService
Service on
Kit.User
to get users and roles of the platform.