DDD-NoDuplicates
DDD-NoDuplicates copied to clipboard
Some design approaches to enforcing a business rule requiring no duplicates. Domain driven design.
I might very well be wrong, but I think only the database approach will guarantee that the invariant is held in a concurrency scenario. Given a scenario where User A...
Given the asynchronous nature of the event handler in the last approach (11_DomainEventsMediatR), there is possibility to have the Name change go through the persistency layer before getting the exception...
Isn't an issue that the Product domain model has public c-tors which do not check for the validity of the name? This makes it possible to have an invalid Product...
**Example** Entity method: ```cs public static User Register( UserId id, IUniqueUsername uniqueUsername, IUniqueEmailAddress uniqueEmailAddress) { /* ... */ } ``` Public interfaces: ```cs public interface IUniqueUsername { public string Value...
I know it's supposed to be an "anti-pattern" but it seems easy enough to just use a service locator. That's what we used to do in our domains and I...
If you receive in the constructor of the User class the number of users with the same email as the int variable. In the constructor, check if it is greater...
Hi When I run all testing in solution, I find the ProductUpdateNameTests of NoDuplicatesDesigns._08_AggregateWithDoubleDispatch can't pass UpdatesNameGivenNewUniqueName/ThrowsExceptionGivenDuplicateName testing. The reason is CatalogRepository didn't create correct Product instances because of lost...