You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
OpenDDD.NET is an open-source framework for domain-driven design (DDD) development using C# and .NET. It provides a set of powerful tools and abstractions to help developers build scalable, maintainable, and testable applications following the principles of DDD.
7
7
8
-
> **Note:** OpenDDD.NET is currently in an alpha state as part of new major version 3. Use with caution in production environments.
8
+
> **Note:** OpenDDD.NET is currently in a beta state as part of new major version 3. Use with caution in production environments.
9
9
10
10
⭐ Consider **starring** and/or **following** the project to stay updated with the latest developments.
11
11
@@ -28,8 +28,6 @@ We're adhering to the key principles and building blocks of Domain-Driven Design
28
28
29
29
## Supported Versions
30
30
31
-
- ASP.NET Core 6
32
-
- ASP.NET Core 7
33
31
- ASP.NET Core 8
34
32
- ASP.NET Core 9
35
33
@@ -57,7 +55,7 @@ To get started with OpenDDD.NET, follow these simple steps:
Copy file name to clipboardExpand all lines: docs/building-blocks.rst
+42-32Lines changed: 42 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
.. note::
2
2
3
-
OpenDDD.NET is currently in alpha. Features and documentation are under active development and subject to change.
3
+
OpenDDD.NET is currently in beta. Features and documentation are under active development and subject to change.
4
4
5
5
.. _building-blocks:
6
6
@@ -57,7 +57,7 @@ An **Aggregate Root** is the entry point to an aggregate. It enforces invariants
57
57
Entity
58
58
------
59
59
60
-
An **Entity** has a unique identity within an aggregate and a lifecycle managed by its Aggregate Root.
60
+
An **Entity** has a unique identity and a lifecycle managed by its Aggregate Root.
61
61
62
62
.. code-block:: csharp
63
63
@@ -181,16 +181,18 @@ Auto-Registration
181
181
182
182
Repositories are **auto-registered** with `IRepository<TAggregateRoot, TId>`. If a custom repository interface exists (e.g., `ICustomerRepository`), it is registered with its corresponding implementation instead.
**NOTE:** If you have more than one implementation of a repository the framework won't know which of them to auto-register. In this case you need to delete one of the implementations or disable auto-registration and register the implementation you want manually.
195
+
194
196
Auto-registration can be **disabled in the configuration**.
195
197
196
198
Create a Custom Repository
@@ -212,11 +214,9 @@ If an aggregate requires additional query methods, create a **custom repository*
@@ -232,26 +232,42 @@ If an aggregate requires additional query methods, create a **custom repository*
232
232
Using EF Core
233
233
-------------
234
234
235
-
By default, OpenDDD.NET uses its **custom persistence provider**, which follows a **document storage model**. This aligns closely with **DDD aggregate patterns** (including Alistair Cockburn’s **Entity pattern**) by storing aggregates **as serialized JSON documents**.
235
+
By default, OpenDDD.NET employs a **custom persistence provider** that stores aggregates as **serialized JSON documents**. This approach aligns with **DDD aggregate patterns** and Pat Helland's **Entity pattern** (see `Life Beyond Distributed Transactions <https://queue.acm.org/detail.cfm?id=3025012>`_), ensuring transactional consistency within each aggregate.
236
+
237
+
For relational storage, OpenDDD.NET supports EF Core as an alternative persistence provider. To use EF Core, you need to:
236
238
237
-
If you need **relational storage**, you can configure **EF Core** as the persistence provider. In that case, you must define:
239
+
- Set the persistence provider to `EFCore` in the configuration.
240
+
- Create a subclass of `OpenDddDbContextBase`.
241
+
- Define entity mappings using `EfAggregateRootConfigurationBase` for aggregates.
242
+
- Define entity mappings using `EfEntityConfigurationBase` for entities.
243
+
- Implement custom repositories by subclassing `EfCoreRepository<TAggregateRoot, TId>`.
244
+
- Register your custom `DbContext` using the `AddOpenDdd<TDbContext>` overload.
245
+
- Ensure aggregates and entities have a **parameterless private constructor** so EF Core can instantiate them.
246
+
247
+
Example JSON configuration:
248
+
249
+
.. code-block:: json
238
250
239
-
- A subclass of `OpenDddDbContextBase`
240
-
- Subclasses of `EfAggregateRootConfigurationBase` for aggregates
241
-
- Subclasses of `EfEntityConfigurationBase` for entities
242
-
- Subclasses of `EfCoreRepository<TAggregateRoot, TId>` for custom repositories
243
-
- Use the `AddOpenDdd<TDbContext>` overload when registering OpenDDD to specify your custom DbContext
See the `Bookstore Sample Project <https://github.com/runemalm/OpenDDD.NET/tree/master/samples/Bookstore/src/Bookstore/Infrastructure/Persistence/EfCore>`_ for examples.
246
262
247
263
Summary
248
264
-------
249
265
266
+
- **OpenDDD.NET includes a built-in persistence provider**, which is used by default and stores aggregates as **serialized JSON documents**.
250
267
- Repositories implement `IRepository<TAggregateRoot, TId>`, ensuring a **consistent API**.
251
-
- Aggregates are stored as **JSON documents** in the configured database.
252
268
- **Auto-registration** registers repositories unless overridden by a custom interface.
253
269
- **Custom repositories** can be created by subclassing a base repository class.
254
-
- **EF Core** can be used instead by configuring it properly.
270
+
- **EF Core** can be used for relational storage by configuring it properly.
255
271
256
272
.. _building-blocks-actions-and-commands:
257
273
@@ -349,7 +365,7 @@ A **Domain Event** represents a significant change within the domain.
349
365
Integration Events
350
366
------------------
351
367
352
-
An **Integration Event** notifies external bounded contexts of domain changes. It is part of your **interchange context** project.
368
+
An **Integration Event** is used to communicate between bounded contexts. It is part of an **interchange context**.
353
369
354
370
**Defining an Integration Event:**
355
371
@@ -382,6 +398,7 @@ Events are published using `IDomainPublisher` (for domain events) or `IIntegrati
382
398
.. code-block:: csharp
383
399
384
400
usingOpenDDD.Domain.Model;
401
+
usingOpenDDD.Domain.Model.Exception;
385
402
usingBookstore.Domain.Model;
386
403
usingBookstore.Domain.Model.Events;
387
404
@@ -400,16 +417,10 @@ Events are published using `IDomainPublisher` (for domain events) or `IIntegrati
0 commit comments