ddd-repositories

Searching for a Child across Aggregate Roots

只谈情不闲聊 提交于 2019-12-01 10:53:06
The repository pattern suggest that you can only pull aggregate roots. But how would you retrieve a single child using only it's uniqiue identity(Child.ID) if you do not know it's parent(root)? class Parent { public int ID { get; set; } IEnumerable<Child> Children { get; private set; } } class Child { public int ID { get; private set; } public virtual Parent Parent { get; private set; } // Navigational model } My application is stateless (web), for simplicity, the request only contains the ID of the child. I am thinking three approaches: Call all the parents then ask them politely who owns

Aggregates, Transactional Consistency and the Entity Framework DbContext

自闭症网瘾萝莉.ら 提交于 2019-11-30 09:57:57
Aggregates must be designed to be transactionally and eventually consistency. This consistency boundary around entities helps manage complexity. In our repository implementations, we are using Entity Framework to interface with the actual database. Historically we have always had huge contexts (spanning scores of tables) which represent every available table, field and relationship in the database (or at least in some functional area of the database). The problem here is that this context is used for hundreds of different things and grows exponentially as the system gets bigger, leading to

DDD repository and factory

人走茶凉 提交于 2019-11-30 02:14:24
In my application a few layers. In this topic will focus on Domain and Infrastructure layers. I have repository interface ClientRepositoryInterface in Domain layer. And I have implementation of this interface ClientRepositoryImpl in Infrastructure layer. But to reconstitute the object in the middle of the cycle of its existence I need factory(ReconstitutionClientFactory). Call the factory will be in the repository. The book by Eric Evans is described as a normal practice. But where this factory(ReconstitutionClientFactory) should be located? In Domain or in Infrastructure layer? I think in

When working with domain models and POCO classes, where do queries go?

末鹿安然 提交于 2019-11-29 14:30:40
问题 I am new to domain models, POCO and DDD, so I am still trying to get my head around a few ideas. One of the things I could not figure out yet is how to keep my domain models simple and storage-agnostic but still capable of performing some queries over its data in a rich way. For instance, suppose that I have an entity Order that has a collection of OrdemItems. I want to get the cheapest order item, for whatever reason, or maybe a list of order items that are not currently in stock. What I don

DDD repository and factory

僤鯓⒐⒋嵵緔 提交于 2019-11-28 23:06:17
问题 In my application a few layers. In this topic will focus on Domain and Infrastructure layers. I have repository interface ClientRepositoryInterface in Domain layer. And I have implementation of this interface ClientRepositoryImpl in Infrastructure layer. But to reconstitute the object in the middle of the cycle of its existence I need factory(ReconstitutionClientFactory). Call the factory will be in the repository. The book by Eric Evans is described as a normal practice. But where this

DDD - How to implement high-performing repositories for searching

眉间皱痕 提交于 2019-11-28 15:55:01
I have a question regarding DDD and the repository pattern. Say I have a Customer repository for the Customer aggregate root. The Get & Find methods return the fully populated aggregate, which includes objects like Address, etc. All good. But when the user is searching for a customer in the UI, I just require a 'summary' of the aggregate - just a flat object with summarised information. One way I could deal with this is to call the find method on the repository as normal, and then in the application layer, map each customer aggregate to a CustomerSearchResult / CustomerInfo DTO, and send them

How to retrieve Domain Object from Repositories

余生颓废 提交于 2019-11-28 04:28:10
问题 I have a little problem understanding repository-domain object relation. Here is some information I know about domain design(they may also be wrong or not accurate). And with these in mind, I can't find a way to obtain a domain object from the repository. In DDD the domain should know and contain only whats needed for the business and everything else must be cleared out of the domain. That's fine. And also abstracting data access from any business is a good practice too. The application doesn

Loading a Value object in List or DropdownList, DDD

牧云@^-^@ 提交于 2019-11-27 19:55:56
I need to clarify something. Have Person Aggreagate , 2 VOs (Country, StateProvince). I want to load all country in my presentation layer (i am using mvc) Evan says you only use repository (IPersonRepository) to work with root entity (it should always return just a reference to the Aggregate Root) public interface IPersonRepository() { void savePerson(Person p); void removePerson(Person p); Ilist<Person> getPerson(); } what i usually do to solve this : Add in IPersonRepository this method IList<Country> LookupCountrysOfPerson(); In Infra layer implement the Domain interfaces like this: public

DDD - How to implement high-performing repositories for searching

落爺英雄遲暮 提交于 2019-11-27 09:28:11
问题 I have a question regarding DDD and the repository pattern. Say I have a Customer repository for the Customer aggregate root. The Get & Find methods return the fully populated aggregate, which includes objects like Address, etc. All good. But when the user is searching for a customer in the UI, I just require a 'summary' of the aggregate - just a flat object with summarised information. One way I could deal with this is to call the find method on the repository as normal, and then in the

Loading a Value object in List or DropdownList, DDD

房东的猫 提交于 2019-11-26 22:51:54
问题 I need to clarify something. Have Person Aggreagate , 2 VOs (Country, StateProvince). I want to load all country in my presentation layer (i am using mvc) Evan says you only use repository (IPersonRepository) to work with root entity (it should always return just a reference to the Aggregate Root) public interface IPersonRepository() { void savePerson(Person p); void removePerson(Person p); Ilist<Person> getPerson(); } what i usually do to solve this : Add in IPersonRepository this method