domain-driven-design

CQRS - how to model a scenario execution system

限于喜欢 提交于 2020-01-01 02:44:06
问题 I recently started investigating CQRS and DDD for a green field project that I'm about to start. I studied a great deal of material from Udi Dahan, Greg Young, Mark Nijhof and others. These were really very helpful and I think I have a good understanding of the concepts. But, there are still certain questions on my mind on how I can apply these to my own domain. My system will basically be a complex rules engine - in which rules will dictate the final price of certain products. The product

Is there a mismatch between Domain-Driven Design repositories and Spring Data ones?

最后都变了- 提交于 2020-01-01 02:28:12
问题 DDD specifies repository per aggregate, but when embracing Spring Data JPA, we can leverage the benefits only when we declare interface per entity. How this impedance mismatch can be resolved? I'm hoping to try out repository interfaces encapsulated within the aggregate repository, is that a OK solution or anything better available? To given an example: Customer is the aggregate root and entities are like Demographics , Identification , AssetSummary etc. where each entity can benefit from

Design Aggregate Root Properly

一世执手 提交于 2019-12-31 22:55:13
问题 I have some problems designing the aggregate root. Here is how I see it in my mind :) Store (the aggregate root) -> Sales - A store create a sale every day -> Zones - A store is divided into zones -> Styles - A zone has x number of styles --> Colors - A style has x number of colors etc.. Now based on this my aggregate root would be the store. However if I were now to create a Repository around that, would it look something like this? public class StoreRepository() { Store GetById() {...}

Passing CQRS commands directly to Domain objects

女生的网名这么多〃 提交于 2019-12-31 17:49:06
问题 ~TLDR: I'm implementing a CQRS + DDD solution for one of my larger projects, and, I'm wondering if there is any real reason that my command handlers can't directly dispatch the command objects to my aggregates, in a small handful of cases, where the command object is data rich? I can't find any specific reason why this would be any kind of an anti-pattern, and I can't find any opinions that go into great detail about this type of design. Background: I have implemented CQRS systems before, and

Passing CQRS commands directly to Domain objects

此生再无相见时 提交于 2019-12-31 17:49:03
问题 ~TLDR: I'm implementing a CQRS + DDD solution for one of my larger projects, and, I'm wondering if there is any real reason that my command handlers can't directly dispatch the command objects to my aggregates, in a small handful of cases, where the command object is data rich? I can't find any specific reason why this would be any kind of an anti-pattern, and I can't find any opinions that go into great detail about this type of design. Background: I have implemented CQRS systems before, and

What is the difference between Invariants and Validation Rules?

*爱你&永不变心* 提交于 2019-12-31 10:38:10
问题 I often see the term Invariants in DDD. Here Dino Esposito talks about it. If I look at the .NET library, I see a ValidationAttribute class. Are Invariants and validation rules the same? For example, can I say 50% discount is available only if the order total is more than $250 is an Invariant? Or are they different where Invariants are to protect an object from becoming invalid and validation is to check the validity of the object even after it has changed it's state (it can be in a valid or

Do we need to use the Repository pattern when working in ASP.NET MVC with ORM solutions?

让人想犯罪 __ 提交于 2019-12-31 08:15:13
问题 I am bit curious as to what experience other developers have of applying the Repository pattern when programming in ASP.NET MVC with Entity Framework or NHibernate. It seems to me that this pattern is already implemented in the ORM themselves. DbContext and DbSet<T> in the Entity Framework and by the ISession in NHibernate. Most of the concerns mentioned in the Repository pattern - as catalogued in POEE and DDD - are pretty adequately implemented by these ORMs. Namely these concerns are,

DDD: entity's collection and repositories

北城以北 提交于 2019-12-31 08:13:36
问题 Suppose I have public class Product: Entity { public IList<Item> Items { get; set; } } Suppose I want to find an item with max something... I can add the method Product.GetMaxItemSmth() and do it with Linq ( from i in Items select i.smth).Max() ) or with a manual loop or whatever. Now, the problem is that this will load the full collection into memory. The correct solution will be to do a specific DB query, but domain entities do not have access to repositories, right? So either I do

What is a practical way to model lookup tables in Domain Driven Design (DDD)?

守給你的承諾、 提交于 2019-12-31 08:03:34
问题 I'm just learning DDD (Eric Evans book is open in front of me) and I've come across a problem that I can't find an answer for. What do you do in DDD when you're just trying to get a simple list of lookup records? Ex. EmployeeID: 123 EmployeeName: John Doe State: Alaska (drop-down) County: Wasilla (drop-down -- will be filtered based on state). For example, let's say that you have an Employee domain object, an IEmployeeRepository interface and an EmployeeRepository class. This will be used by

Enforce invariants spanning multiple aggregates (set validation) in Domain-driven Design

蹲街弑〆低调 提交于 2019-12-31 04:43:28
问题 To illustrate the problem we use a simple case: there are two aggregates - Lamp and Socket . The following business rule always must be enforced: Neither a Lamp nor a Socket can be connected more than once at the same time. To provide an appropriate command we conceive a Connector -service with the Connect(Lamp, Socket) -method to plug them. Because we want to comply to the rule that one transaction should involve only one aggregate, it's not advisable to set the association on both