domain-driven-design

Is injecting repository in aggregate root / entity considered bad design?

浪子不回头ぞ 提交于 2019-12-24 22:32:16
问题 I am trying to learn about details of domain driven design and i came to this question. I found many examples with: Defining repository interface within the domain Defining repository implementation somewhere else Inject repository interface into aggregate root On the other hand, there are examples that strictly go against it and do all repository related stuff from service. I cannot find authoritive answer and explanation: is it considered a bad practice and if so - why? 回答1: I cannot find

In domain driven design, why would you use an “aggregate” object and what key principles would you apply when designing an aggregate?

倖福魔咒の 提交于 2019-12-24 21:10:28
问题 I am new to DDD, and so am just understanding the basic concepts around it. Can someone please guide me more towards aggregate objects in DDD? particularly, why would you use an “aggregate” object and what key principles would you apply when designing an aggregate? Thanks, 回答1: Let's start it from the beginning. A long time ago in a galaxy far, far away there were SQL databases with ACID transactions. What we are really interested here are the atomicity and consistency from the ACID ancronym.

Discriminator field and data modeling

别等时光非礼了梦想. 提交于 2019-12-24 19:29:30
问题 I have the following case. A reservation, this reservation be canceled, it can be newly created it can be Confirmed it can be rejected. There might be different reasons for cancelation. Lets say the reservation has expired, or it may have not been processed within certain timelimit or some other reason. In order for a reservation to be confirmed a multiple sub - transactions should be performed. This mean that there is a flow within the Confirmation itself. The solution my team came with is

DDD: Confusion about repository/domain boundaries

扶醉桌前 提交于 2019-12-24 17:20:08
问题 My domain consists of Products, Departments, Classes, Manufacturers, DailySales, HourlySales. I have a ProductRepository which facilitates storing/retrieving products from storage. I have a DepartmentAndClass repository which facilitates storing/retrieving of departments and classes, as well as adding and removing products from those departments and classes. I also have a DailySales repository which I use to retrieve statistics about daily sales from multiple groupings. ie.. DailySales

Where does DTOS as InputModel / ViewModel Fit in Layered Archicture

笑着哭i 提交于 2019-12-24 11:34:31
问题 I'm trying to understand where does InputModel and ViewModels fit at the 4 Layer Architecture. Presentation | Application | Domain | Infrastructure Given that the Application Layer takes care about exchange data beteween Presentation Layer and Domain Layer, I supposed that, they must live inside this layer, as well the adapter to convert It back to Domain Entity and vice versa. InputModels, also know as Commands, in ASP.NET MVC they can coincide with ViewModels. Makes no sense to me

Provide a human-readable representation of an identifier?

情到浓时终转凉″ 提交于 2019-12-24 11:05:52
问题 As a follow-up to a previous question where I asked for a solution to a broken problem, I'm trying to find a way to express an arbitrary identifier in a "readable" way. Context: we are working with entities (domain model objects from DDD), which have an identity . This identity (mapped to a database primary key) can be expressed as a string: '123' , 'ABC' . Some entities can have a compound identity , i.e. composed of two or more other entities' identity : array('123','ABC') . Sometimes, we

What is an Aggregate Function?

萝らか妹 提交于 2019-12-24 10:30:25
问题 I am trying to learn Event Sourcing (using Greg Youngs Event Store) in my spare time. I have setup a simple stream and I can read from it and write to it. Please see this link: https://eventstore.org/docs/getting-started/?tabs=tabid-1%2Ctabid-dotnet-client%2Ctabid-dotnet-client-connect%2Ctabid-4. It says: "If you are Event Sourcing a domain model, a stream equates to an aggregate function." I don't believe I have ever come across the term Aggregate Function before - I know aggregate root and

DDD - Does DAL access Domain Layer

◇◆丶佛笑我妖孽 提交于 2019-12-24 07:27:51
问题 I see some samples referencing the Domain Layer from DAL. I see that the repository interfaces are defined in the Domain Layer and since the DAL implements them, they need to reference the Domain Layer. The DAL also needs to know the Entities to return so the reference upstream. I thought that we only reference "downstream", can someone explain? 回答1: Yes, that's OK. Think about it like this: If you are going to change (replace) any layer, what layer will it be? It's highly unlikely that you'd

How to avoid holding reference to non-root-aggregate in another non-root-aggregate?

喜你入骨 提交于 2019-12-24 07:17:15
问题 In many ddd examples we have a simple: Order (aggregate root [AR]) and OrderLine (aggregate member [AM]) + Invoice (aggregate root [AR]) and InvoiceLine (aggregate member [AM]) In that examples we issue an invoice on order so it is direct reference from one AR (Invoice) to another (Order) which is clearly correct. However, in my case things are more complicated: We issue an Invoice on many OrderLines from different Orders. So on one Invoice, we have: InvoiceLine #1 referencing to OrderLine #1

ASP.NET Boilerplate Domain Layer appears to contain non-Domain classes

妖精的绣舞 提交于 2019-12-24 07:15:25
问题 I have recently done some analysis of ASP.Net Boilerplate (https://aspnetboilerplate.com). I have noticed that the domain layer (MyProject.Core) has folders for the following (these are created by default): Authorization Confirguration Editions Features Identity Localization MultiTenancy etc Why would you put all of this in the Domain Layer of an application? From what I can see; I believe most of this code should be found in the Application Layer (which could also be the service layer). 回答1: