Skip to content

CoreServiceCollectionExtensions class

namespace: Serenity.Extensions.DependencyInjection   assemblySerenity.Net.Core

Contains extensions to register core services.

public static class CoreServiceCollectionExtensions

Public Members

name description
static AddAnnotationTypes(…) Adds the annotation type registry.
static AddAutoRegisteredServices(…) Registers all the types with an RegisterService attribute (RegisterSingleton, RegisterScoped, RegisterTransient etc.) from the type source in the service collection if available, or using the provided typeSource, optionally filtering implementation types via a provided predicate. Use this at the end of InitializeServices in Startup.cs so that services can be overridden before others.
static AddCaching(…) Adds memory caching as ILocalCache implementation and a distributed cache emulator as IDistributed cache implementation.
static AddFeatureToggles(…) Adds the IFeatureToggles service to the registry.
static AddServiceResolver(…) Adds on demand service resolver to the registry.
static AddSingletonWrapped<TService,TWrapper,TImplementation>(…) Adds a singleton service of the type TService with the implementation type TWrapper that wraps the TImplementation to the IServiceCollection.
static AddSingletonWrapped<TService,TWrapper1,TWrapper2,TImplementation>(…) Adds a singleton service of the type TService with the implementation type TWrapper1 that wraps the TWrapper2 which itself wraps the TImplementation to the IServiceCollection.
static AddTextRegistry(…) Adds the local text registry.
static AddTypeSource(…) Adds a type source to the registry.
static AddUserProvider(…) Adds the DefaultUserProvider as IUserProvider implementation to the service collection. Note that it requires IUserRetrieveService, IUserAcessor to be registered in the service collection. It also tries to register the DefaultUserClaimCreator.
static AddUserProvider<TUserAccessor,TUserRetrieveService>(…) Adds the DefaultUserProvider as IUserProvider implementation to the service collection. Also registers the given IUserAccessor and IUserRetrieveService implementations and tries to register the DefaultUserClaimCreator implementation.
static AddUserProvider<TUserAccessor,TUserRetrieveService,TUserClaimCreator>(…) Adds the DefaultUserProvider as IUserProvider implementation to the service collection. Also registers the given IUserAccessor, IUserRetrieveService and IUserClaimCreator implementations.

See Also