Transactions in the Repository Pattern

How do I encapsulate the saving of more than one entity in a transactional manner using the repository pattern? For example, what if I wanted to add an order and update the customer status based...

Domain Driven Design: Aggregate root & Sub Aggregate roots

In my project, i am finding the need to break my aggregate in a hierarchical fashion, with top root level aggregate, which ensures consistency of rules at root level, and then my objects under the...

Paging in NHibernate

Lets say I have a domain model with a class called Blog that has a property called BlogEntries (that contains objects of type BlogEntry). If I have a database model with two tables "Blog" and...

Domain Driven Design: Domain Service, Application Service

Can someone explain the difference between domain and application services by providing some examples? And, if a service is a domain service, would I put the actual implementation of this service...

Domain driven content management?

I'm wondering - what i should keep in mind when trying to apply domain driven design on CMS app that has quite complex business logic? Aren't those beasts mutually exclusive? Here's article to...

Retrieval of child objects of aggregates in DDD

In DDD root of an aggregate is the only reference to retrieve its child objects. Repository of root of an aggregate is responsible for giving the root object reference only. If I need child...

DDD: the Repository contract

I've read in various places that one important requirement in DDD is to have a bounded contract for the Repository: findByName(string name) findByEmail(string email) etc. And not provide a...

DDD. Where do user configurable settings belong?

I'm working on my first "real" DDD application. Currently my client does not have access to my domain layer and requests changes to the domain by issuing commands. I then have a separate...

DDD - How to design associations between different bounded contexts

I have setup a domain project which is being populated with an ORM. The domain contains of different aggregates each with its own root object. My question is how properties that cross the...

Declarative Domain Model possible (DDD)?

I'm looking for insight/ papers/ articles, etc. whether a fully declarative Domain Model (as per DDD) is possible. For example: Validation can be declarative (lot's of ORMs do this) business flow...

Entity Framework and eager loading and enterprise application with DDD aproach

We are trying to create an ASP.NET MVC 4 application using Entity Framework (EF) with domain-driven design (DDD) style pattern approach. As you can see in our part of domain layer, we have a...

Lazy loading in Entity Framework with the repository pattern

I have a entity like: public class Doctor : User { public Doctor(string userName, string firstName, string lastName, string mobileNumber, string email, Sexes sex, Role myRole,...

DDD: Entity identity before being persisted

In Domain Driven Design, one of the defining characteristic of an Entity is that it has an identity. Problem: I am not able to provide a unique identity to Entities on instance creation. This...

Can Domain Services access Repositories?

Can Domain Services access Repositories? Or they should work on Aggregates/Entities passed to them by Application Services? Consider two code samples of the same business operation - money...

Exposing ASP.NET Identity Services in DDD

We are developing a DDD based application developed using ASP.NET MVC , C# and EF6. It has been decided to implement the Authentication and Authorization using ASP.NET Identity Service... I have...

DDD - which layer DTO should be implemented

I am learning about DDD so apologies if my question is naive. I think I need to use Local Data Transfer Object in order to display data to the users as a lot of properties are not part of any of...

DDD, difference between a Saga and an Event Dispatcher?

On multiple sites (e.g. here or here Sagas are described as a mechanism that listens to domain events and reacts to them, executing new commands, and finally modifying the domain, etc. Is there...

When should I use a record over a tuple?

I am trying to practice Domain Driven Design in F# and stumbled across the following question: Why would I use a record when using a tuple appears to require less syntax and appears to be more...

DDD: Referencing MediatR interface from the domain project

I'm just getting started with DDD. I'm putting domain events into a CQRS application and I'm stumbling on a fundamental task: How to use the MediatR.INotification marker interface within the...

Can aggregate root reference another root?

I'm a little bit confused. I just watched Julie Lerman's Pluralsight video on DDD and here's the confusion I have: Having a simple online store example with: Purchase Orders with Items for...

EF Core how to implement audit log of changes to value objects

I am using EF Core/.NET Core 2.1, and following DDD. I need to implement an audit log of all changes to my entities, and have done so using code from this blog post (relevant code from this post...

How to validate a factory method?

How to validate a factory method (The construction of object). public static readonly byte MaxWorkDayHours = 12; public static WorkTime Create(Guid WorkTimeRegulationId, String name, byte...

How to easily compare a domain object with related entities in order to update database with EF Core?

For my ASP.NET Core API project, I am smoothly moving from a standard repository pattern approach (with most of the business logic in the repo layer) to the very seducing DDD approach. My domain...

Nestjs Dependency Injection and DDD / Clean Architecture

I'm experimenting with Nestjs by trying to implement a clean-architecture structure and I'd like to validate my solution because I'm not sure I understand the best way to do it. Please note that...

Should we use 'package by feature' structure with DDD?

After doing some research, I got confirmation that folder-by-feature structure is superior to folder-by-layer structure in the majority of cases. To get some arguments we can read, among others,...

Domain Service vs Application Service By Example

I know there is a lot of questions (And answers) about the difference between Domain Service and Application Service. One of the most viewed answers regarding this is this one:...

Domain Driven Design: dart package freezed gives "Failed Assertion boolean expression must not be null"

I am trying to build email model with authentication using this tutorial https://www.youtube.com/watch?v=fdUwW0GgcS8&list=PLB6lc7nQ1n4iS5p-IezFFgqP6YvAJy84U&index=2 The code is: import...

Is MediatR library overused in CQRS examples on the web?

I'm struggling to understand why so many examples on the web are using MediatR when explaining CQRS patterns, when dealing with commands and queries. Almost everywhere I see examples where...

Domain Model modelling how complex should the diagram be/become?

I am incredibly new to Domain Models and I am trying to build up my understanding. I have created this domain model around a scenario which I will provide. I feel this model is simple and as a...

How can I add extra view component class paths in Laravel?

The problem The default namespace for view components is App\View\Components with the folder being app/View/Components. I am setting up a DDD file structure and wish to do two things: Move...