Litium API

In Litium 5 the a new API is introduced in the product management. In future versions this new API will cover the rest of the product.


The API is structured into different assemblies to separate the domain entities and services contracts from application logic. When you extend and build customer specific functionality you only need to include references to the assemblies that contains domain entities and service contracts. This way you will have minimal external dependencies.

A service contract can be either the domain service that will handle the entity or an extension point. Domain service have an abstract class as a contract and extension points have interfaces as a contract.

Domain entities and service contracts that have breaking changes, except classes or interface in namespace that is Internal, will be announced in release notes for each release. Classes or interfaces in the Internal namespace should not be used in customer project solutions and can be removed by Litium without notice.

Assembly naming for assemblies that contains the domain entities or service contracts.

  • Litium.Abstractions - contains core domain entities and service contracts.
  • Litium.Web.Abstractions - contains domain entities and service contracts for web applications.
  • Litium.Web.Mvc.Abstraction - contains domain entities and service contracts for ASP.NET MVC applications.
  • Litium.Web.WebApi.Abstractions - contains domain entities and service contracts for ASP.NET WebAPI applications.
  • Litium.Web.Administration.Abstractions – contains domain entities and service contracts for extending administration interface.

Namespace in the assembly is the same as assembly name without “Abstraction”.


Designing of an application can be made with

  • static instance that contains the services and caches
  • dependency injection that holds the state of the services and inject the dependency (constructor parameters) for the service into the instance.

Services in API is designed to use dependency injection where it is possible. When using dependency injection; services can easily be extended or replaced. Services is used to create/read/update/delete the entity.

How to find correct service?

If the entity name is "Entity" the service name is "EntityService", example entity = BaseProduct, service = BaseProductService. The service exists in the same namespace as the entity.

Readonly entities

All entities that implement Litium.ComponentModel.IReadOnly can be in readonly mode to prohibit that the entity is changed. To change an entity that is readonly the method MakeWritableClone need to be invoked to create a clone of the object that is changable.

Database manipulation of data

Litium strongly advice you to never change the data direcltly in the database. If you anyway choose to do this:

  • you are responsible to ensure business rules are met
  • you are responsible to ensure that correct events are fired
  • you are responsible to ensure that search indexes are updated


Is this page helpful?
Thank you for your feedback!