EntityStitching enables defining aggregate boundaries by specifying which entities belong together, independent of how data is loaded, joined, or materialized.
EntityStitching is framework-agnostic by design, with integrations delivered through separate packages.
Install the core package from NuGet:
dotnet add package EntityStitchingIf you are using EntityFramework, also install the integration package:
dotnet add package EntityStitching.EntityFrameworkCoreEntityStitching revolves around aggregate boundaries, which represent a set of property paths associated with an aggregate root.
You start from an empty aggregate boundary and progressively include properties using a fluent, strongly-typed API:
var boundary = new AggregateBoundary<Order>()
.Include(o => o.Customer)
.ThenInclude(c => c.Address)
.Include(o => o.Items);The resulting aggregate boundary is expressed as a structured collection of property paths that define how the aggregate root is composed with related entities.
When using EntityFramework, the aggregate boundary can be applied directly to an existing IQueryable<TEntity>:
var query = dbContext.Orders.Include(boundary);The integration translates the property paths defined in the aggregate boundary into the corresponding EntityFramework includes.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.