domain-driven-design

How to write read-only accessor functions in an aggregate root class?

ぐ巨炮叔叔 提交于 2019-12-13 07:19:37
问题 Overall design : I have an aggregate class C that contains N member variables of type M_i, i = 1 ... N that each have a common write-only update() interface as well as class-specific read-only accessor functions [F]un_i(), [F] = any letter, i = 1 .. N (they do not have such regular names in reality). Each of the member types M_i forms an independent abstraction of its own, and is used elsewhere in my program. The aggregate class needs to update all the members in a single transaction, so it

DDD - Mapping Value Objects with Fluent nHibernate in separate tables

浪子不回头ぞ 提交于 2019-12-13 06:56:50
问题 EDIT: Hi, trying an edit to get this question answered. In order to try improve the question, here is a straight to the point condensed version: Is the code below the way to go when mapping value objects to separate tables using fluent nhibernate, or is there an alternative? Hi, For the purpose of this question I am using nhibernate fluently configured. I'm steadily learning DDD but am after some clarification with the mapping of value objects. There seems to be a lot of information regarding

A domain entity exposing a repository-like method

纵然是瞬间 提交于 2019-12-13 05:39:03
问题 Take this example. A Supervisor domain class exposes a method GetUnderlings(DateTime from, DateTime to) which will return all those people supervised by the given supervisor in the given period. The method should go here for pleasing semantic reasons. But should go somewhere else for DDD purity. That's because I'm assuming to implement the method one would need to use a Repository, which it seems wrong to embed inside the Domain Entity. In that case, the method should go on a Respository or

In DDD/CQRS, should ReadModel act as ViewModel, if not then where belongs responsibility for mapping?

孤者浪人 提交于 2019-12-13 04:25:40
问题 Assume read model ProductCatalogueItem is built from aggregates/write-models, stored separately from write-models, and contains each product available for selling, and has following properties: basics: product_code , name , price , number_of_available_stock , documentation: short_description , description ,... product characteristics: weight , length , depth , width , color ,... And, there are two views: product list containing list/table/grid of available product offers, and the view needs

How to avoid aggregate being dependent on outside includes?

帅比萌擦擦* 提交于 2019-12-13 04:17:49
问题 I do not use lazy loading. My root aggregate have entities (collection navigation properties). I want my aggregate to be self-contained, responsible for itself, and follow the Single Responsibility Principle (SRP), and adhere to high cohesion and low coupling. The problem is that the code that retrieves the root aggregate needs to include certain child entities depending on which way it wants to interact with the aggregate. Example: public class Blog // My root aggregate { public ICollection

External data mapping to domain

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 03:45:43
问题 It feels like I am referring to DDD topics of context mapping and anticorruption layer, but I am not sure how to address it. How to construct/map domain objects from external data sources? As an example there could be multiple data sources (db, files, external services). Since I am trying to build as similar to onion architecture as possible it means that my domain has no dependencies. Infrastructure depends on domain (specifically, infrastructure implements domain interfaces) If

Does this Entity Repository Service example fit into Domain-Driven Design?

拟墨画扇 提交于 2019-12-13 02:49:09
问题 I would like to know if you find the following pattern meaningful in domain driven design. The domain layer consists of model and repository. The application layer consists of services that handles queries from the user interface, or from controllers in the Model-View-Controller pattern. Details of the structure: // Assembly Model: public class Phrase { public int PhraseId { get; private set; } public string PhraseText { get; private set; } public Phrase(string phraseText) { this.PhraseText =

Value Object as a Service Call Argument

喜你入骨 提交于 2019-12-13 02:07:43
问题 In the book Implementing DDD, there's mention of creating a TenantId value object. This makes sense to me, as a GUID could be empty which isn't a valid TenantId , so by making a TenantId value object I can protect against this (I also have other value objects like Name , PhoneNumber , EmailAddress , etc): public class TenantId { public TenantId(Guid id) { this.SetId(id); } public Guid Id { get; private set; } private void SetId(Guid id) { if (id == Guid.Empty) { throw new

Applying mvc to domain-driven design

不打扰是莪最后的温柔 提交于 2019-12-13 01:39:50
问题 From a practical point of view, how can you adapt the domain model to the MVC pattern? For example, could I use some wrapper classes? 回答1: They aren't really related. MVC is a design pattern for separating the concerns of storing data (model), presenting various views of the data (view), and interacting with that data (controller). While it may be a "design" pattern, it is really about the design of code. The views are usually, but not necessarily used for GUIs. Domain-Driven Design is a

WCF with ASP.NET MVC - Reference Projects

守給你的承諾、 提交于 2019-12-13 00:38:11
问题 on a ASP.NET MVC project, the data access layer is going to be implemented in WCF. Reason is that these WCF services are going to be consumed by couple of other client applications in the future. Can I know whether there are any good reference projects that I can have a look at. Important things that I need to have a look at are: How the projects are structured Any best practices that need to be followed How Domain objects/POCOs, DTOs, ViewModels need to be organized, and communicate between