C# ServiceKits (v14)
ServiceKits help you get a Service with fewer lines of code. The Kit is provided on the Kit
property.
For example, you may need to call the IPageService Activate. With the v14 API it looks like this:
@Kit.Page.Activate("turnOn")
The Kit Property
The Kit
property is available on all of your code which inherits from any one of these:
Custom.Hybrid.Api14
for Web APIsCustom.Hybrid.Code14
for custom codeCustom.Hybrid.Razor14
for Razor
The Kit in all ...14
base classes will always be a ServiceKit14.
They are...
- lazy so they are only created if ever needed
- created and preserved so multiple access to the service won't cause any overhead
- versioned so that we can continue to enhance the APIs without breaking existing Razor
Services in the ServiceKit
This will depend on the ServiceKit you will use.
In v14, the Kit will then always be a ServiceKit14. You can read about the included servicen in those docs.
History of Dependency Injection in 2sxc
- 2sxc introduced Dependency Injection 1.1 in v9 (May 2017)
- Integrated with Oqtane DI in v12 (May 2021)
GetService<T>
pattern introduced for Razor/C# in v12 (May 2021)- Integrated with Oqtane DI in v12 (May. 2021)
- Upgraded to Dependency Injection 2.1 in v13 (Dec. 2021)
- Integrated with Dnn DI in v13 (Dec. 2021)
- Created ServiceKits for v14 (June 2022)
- Added ServiceKitLight for custom DataSources in 2sxc 15
- Added ServiceKit16 for 2sxc 16