-
Notifications
You must be signed in to change notification settings - Fork 0
bounded contexts
Ideally, each Bounded Context (BC) is mapped to a single .NET assembly (i.e. .NET project). For simpler models, you probably only need a single assembly.
Step 1: Open your Domain Model project
Step 2: Add a reference to each of your domain assemblies:

Step 3: Register each domain assembly in your bootstrapper code using WithModelAssembly:
...
var typeFromBoundedContext1 = typeof(Acme.OnlineShopping.CustomerAccounts.Customer);
var typeFromBoundedContext2 = typeof(SampleModelForDocs.BasicPropertyTypes);
var builder = new HostApplicationBuilder(args);
builder.AddFresnel(opt =>
{
opt
.WithModelAssembly(typeFromBoundedContext1.Assembly) //👈
.WithModelAssembly(typeFromBoundedContext2.Assembly) //👈
...
;
});When starting out, consider using just a single assembly to keep things simple and fast. Use separate namespaces for each BC. Refactor into multiple assemblies when the domain model gets larger and more complicated.
Refrain from creating dependencies between your BCs/assemblies. If you discover dependencies between them, you may need a messaging system to handle the communications (possibly using messages buses and/or microservices)
Fresnel does not include a messaging mechanism, so try libraries such as MediatR to simulate the communications.
Copyright © 2022-2025 Envivo Software
-
Objects
-
Configuring your Model
-
Testing your model
-
Other features