domain-driven-design

DDD Aggregate Root / Repository Structure

最后都变了- 提交于 2021-02-08 13:52:52
问题 I am new to this, so my understanding is still flaky. I have a Person model and an AccountType model in my project. Each person references an account type. Now if my understanding is correct a Person is definitely an aggregate root, whereas the AccountType probably isn't as the entries in the account type table are going to be pretty much static and are certainly have no meaning outside of a Person. However when I create a new person I need to set the account type, so it would seem I need a

DDD Aggregate Root / Repository Structure

北慕城南 提交于 2021-02-08 13:52:31
问题 I am new to this, so my understanding is still flaky. I have a Person model and an AccountType model in my project. Each person references an account type. Now if my understanding is correct a Person is definitely an aggregate root, whereas the AccountType probably isn't as the entries in the account type table are going to be pretty much static and are certainly have no meaning outside of a Person. However when I create a new person I need to set the account type, so it would seem I need a

DDD: How do structure or resolve more complex behaviour in a domain entity?

你。 提交于 2021-02-08 07:22:54
问题 Assume the classic Order/OrderLine scenario. public class Order { ... public void AddOrderLine(OrderLine ol) { this.OrderLines.Add(ol); UpdateTaxes(); } private void UpdateTaxes() { //Traverse the order lines //Collect the VAT amounts etc //Update totals var newTaxes = Orderlines.SelectMany(ol => ol.GetTaxes()); Taxes.Clear(); Taxes.Add(newTaxes); } } Now, we figure that we need to handle taxes better, with different ways for customers in various countries etc, where some require VAT to be

DDD: How do structure or resolve more complex behaviour in a domain entity?

自闭症网瘾萝莉.ら 提交于 2021-02-08 07:22:16
问题 Assume the classic Order/OrderLine scenario. public class Order { ... public void AddOrderLine(OrderLine ol) { this.OrderLines.Add(ol); UpdateTaxes(); } private void UpdateTaxes() { //Traverse the order lines //Collect the VAT amounts etc //Update totals var newTaxes = Orderlines.SelectMany(ol => ol.GetTaxes()); Taxes.Clear(); Taxes.Add(newTaxes); } } Now, we figure that we need to handle taxes better, with different ways for customers in various countries etc, where some require VAT to be

Are Domain Models different from the Database models?

大城市里の小女人 提交于 2021-02-08 06:14:33
问题 I understand the concepts in DDD but in practise it gets a bit confusing. I am using C#, SQL Server and EF. I see that based on my database schema, the persistence models would look different from my aggregates. In order to define clean, nice aggregates, entities and value objects, my domain models would look different from the database models. Moreover, if I try to merge these 2 then somehow I try to design my domain models more based on technology, not on domain. Maybe a more concrete

Are Domain Models different from the Database models?

放肆的年华 提交于 2021-02-08 06:14:29
问题 I understand the concepts in DDD but in practise it gets a bit confusing. I am using C#, SQL Server and EF. I see that based on my database schema, the persistence models would look different from my aggregates. In order to define clean, nice aggregates, entities and value objects, my domain models would look different from the database models. Moreover, if I try to merge these 2 then somehow I try to design my domain models more based on technology, not on domain. Maybe a more concrete

Defining a Message Passing domain with very many message types

会有一股神秘感。 提交于 2021-02-07 18:10:21
问题 Most F# Message Passing examples I've seen so far are working with 2-4 message types, and are able to utilize pattern matching to direct each message to its proper handler function. For my application, I need hundreds of unique message types due to the different nature of their handling and required parameters. So far, each message type is its own record type with a marker interface attached, because including hundreds of types in a single discriminated union would not be very pretty - and

Defining a Message Passing domain with very many message types

佐手、 提交于 2021-02-07 18:05:59
问题 Most F# Message Passing examples I've seen so far are working with 2-4 message types, and are able to utilize pattern matching to direct each message to its proper handler function. For my application, I need hundreds of unique message types due to the different nature of their handling and required parameters. So far, each message type is its own record type with a marker interface attached, because including hundreds of types in a single discriminated union would not be very pretty - and

What approach is there for handling and returning errors (non-exceptional and exceptional) in Domain Driven Design entities and aggregate roots?

我怕爱的太早我们不能终老 提交于 2021-02-07 11:48:20
问题 I'm trying to find a good article/examples of how DDD entities treat errors (and what would be considered exceptional errors and what wouldn't) and how they pass them up to the calling application layer (which usually wraps operations in a transaction that would need to be rolled back). Currently I'm thinking to consider all errors that would break the transaction of an aggregate (such as validation) to be exceptions. This way I can rollback the transaction in a "catch" block. For example:

DDD Value Objects and Entity Without ORM Mapping in PHP

独自空忆成欢 提交于 2021-02-07 11:00:27
问题 First, as I know, Entity in DDD is almost same with Value Object except Entity has identity. Every article I have read say same thing that entity id has ORM mapping with any ORM tool. But I don’t want to use ORM mapping in Entity. Instead, I would like to do database operation with Repository Interfaces without mapping. And, in this case, I am stuck on how I should do this. I will explain in my mind with an example below Let’s assume I have a TODO application and there are some questions in