Skip to content
xhafan edited this page Jan 15, 2019 · 54 revisions

Welcome to the CoreDdd documentation!

CoreDdd is a set of open-source .NET libraries helping with domain-driven design (DDD) and CQRS. The intention of CoreDdd libraries is to provide basic DDD and CQRS infrastructure, so a developer can concentrate on building the business features, and not on re-inventing the DDD/CQRS infrastructure code. Domain entity database persistence is currently supported only via NHibernate into a SQL database. CoreDdd supports .NET Core and full .NET framework. CoreDdd libraries were tested on Windows and Linux with databases SQL Server, PostgreSQL and SQLite. All SQL databases supported by NHibernate are supported by CoreDdd.

There are following CoreDdd libraries available on nuget:
https://www.nuget.org/packages/CoreDdd
https://www.nuget.org/packages/CoreDdd.Nhibernate
https://www.nuget.org/packages/CoreDdd.AspNetCore
https://www.nuget.org/packages/CoreDdd.AspNet
https://www.nuget.org/packages/CoreDdd.Nhibernate.Register.Castle
https://www.nuget.org/packages/CoreDdd.Nhibernate.Register.DependencyInjection
https://www.nuget.org/packages/CoreDdd.Nhibernate.Register.Ninject
https://www.nuget.org/packages/CoreDdd.Register.Castle
https://www.nuget.org/packages/CoreDdd.Register.DependencyInjection
https://www.nuget.org/packages/CoreDdd.Register.Ninject

To start using CoreDdd on your project, add CoreDdd package into your project, and create a domain entity derived from Entity and implementing IAggregateRoot interface, example:

public class Ship : Entity, IAggregateRoot
{
}

By deriving from Entity class the domain entity gets Id of type int. You can also derive from Entity<TId> to get custom Id type, e.g. by deriving from Entity<long> or Entity<string>). By implementing IAggregateRoot interface the domain entity is marked as an aggregate root domain entity, which is available to be persisted and retrieved from a database using a repository. Non-aggregate root entities (those derived from Entity but not implementing IAggregateRoot interface) is not possible to directly load from a database using a repository. Non-aggregate root entities belong to and are managed by an aggregate root domain entity.

Once an entity is persisted into a database, it can be queried. To modify an application state using aggregate root domain entities, use Commands. There is a more complex DDD code sample available here. To announce that some domain activity has happened, and to defer some application processing to a later time, use domain events.

Found an issue with CoreDdd libraries? Please create a new issue.