Dependency Injection

Serenity uses the dependency injection pattern to abstract its dependencies and make it possible to work with your chosen libraries and service providers.

Serenity is deeply integrated with built-in Dependency Injection feature of ASP.NET Core.

We provide some extension methods to easily configure the default Serenity services in Serenity.Extensions.DependencyInjection namespace of some Serenity assemblies:

assembly class
Serenity.Core CoreServiceCollectionExtensions
Serenity.Entity EntityServiceCollectionExtensions
Serenity.Services ServiceCollectionExtensions
Serenity.Web DynamicScriptServiceCollectionExtensions

See document below for more info about DI in ASP.NET Core framework:

Before v5, Serenity used to have a service location container, but since then we completely migrated to ASP.NET Core DI.