-
Notifications
You must be signed in to change notification settings - Fork 0
domain services
There may be occasions when some domain logic needs to exist, but cannot be attributed to any specific domain object. This is where Domain Services come in – they are stateless and operate on domain objects.
To create one, implement the IDomainService interface like so:
using Envivo.Fresnel.DomainTypes.Interfaces;
/// <summary>
/// Used to send re-supply orders to Suppliers
/// </summary>
public class StockReplenishmentService : IDomainService //👈
{
/// <summary>
/// Identifies all low stock levels, and sends order emails to the relevant suppliers
/// </summary>
public void SendOrdersToSuppliers()
{
/// Domain logic goes here
...
}
}This service appears in the navigation panel, and the action appears as a sub-option:

Methods on Domain Services may also accept parameters and other dependencies. See the Methods section for more information.
Domain Services can keep code clean, by maintaining separation between the Object (data) and the operations (logic).
But when exploring domain concepts with people, it helps if the actions are visually linked directly to the domain Objects. You can see an example of this in the Methods with Dependencies section.
Copyright © 2022-2025 Envivo Software
-
Objects
-
Configuring your Model
-
Testing your model
-
Other features