domain-driven-design

Bounded contexts sharing a same aggregate

假装没事ソ 提交于 2020-01-06 13:11:03
问题 DDD exposes bounded contexts, domain models, aggregates... but I often miss the keypoint of business rules. I would like to know how business rules integrate into this approach. Here is an example : Imagine you have 2 bounded contexts in a credit company. One for debt recovery, the other for early refunds. These contexts embed real business specificities. In a conceptual point of view, I think these bounded contexts should separately embed common model parts, and similar domain model entities

Adding Data from UI to different microservices

依然范特西╮ 提交于 2020-01-06 07:58:13
问题 Imagine you have a user registration form, where you fill in the form: First Name, Last Name, Age, Address, Prefered way of communication: Sms, Email (radiobuttons). You have 2 microservices: UserManagement service Communication service When user is registered we should create 2 aggregates in 2 services: User in UserManagementContext and UserCommunicationSettings in Communication. There are three ways I could think of achieving this: Perform 2 different requests from UI. What if one of them

How to handle dependent behavior in a domain class?

主宰稳场 提交于 2020-01-05 13:08:14
问题 Let's say I've got a domain class, which has functions, that are to be called in a sequence. Each function does its job but if the previous step in the sequence is not done yet, it throws an error. The other way is that each function completes the step required for it to run, and then executes its own logic. I feel that this way is not a good practice, since I am adding multiple responsibilities, and the caller wont know what all operations can happen when he invokes a method. My question is,

Fluent NHibernate HasMany Collection Problems

萝らか妹 提交于 2020-01-05 09:15:30
问题 Update: It appears that changing my mapping from Cascade.All() to Cascade.AllDeleteOrphan() fixes most of my issues. I still have to explicitly set the Company property on the OperatingState, which seems unnecessary as it's being added to the Company entity, but at least I can work with that during an update. I still need to test that with a create. If any one can explain that, that would be a big help. Update 2: After playing with it some more, it appears I don't always have to specify the

Fluent NHibernate Mapping for DDD Model

ぃ、小莉子 提交于 2020-01-05 05:59:07
问题 I have been trying to look for solutions to the problem that I am currently having with mapping my DDD model using Fluent NHibernate. If someone can just put me in the right direction that would be appreciated. Basically I have this class that I would like to map: public class A : EntityObject { //assuming some other attributes have been mapped properly public virtual Location MyLocation { get; private set; } } public class Location : EntityObject { public virtual string Name { get; private

Entity framework and Eager loading and enterprise application with DDD aproach

北慕城南 提交于 2020-01-05 05:44:06
问题 ITNOA We are trying to create an ASP.NET MVC 4 application using entity framework with domain driven development style pattern approach. As you can see in our part of domain layer, we have a complex design. We need to load entity with lazy as well as eager methods. Unfortunately we have big problem with these methods in entity framework. As we understand, for eager loading in EF we have to use the Include method and give string of properties and properties of properties etc. (In Hibernate and

Presentation of an Aggregate Member

那年仲夏 提交于 2020-01-05 05:10:10
问题 How do you expose an aggregate member for the purpose of presentation, while at the same time preventing that member from getting modified directly? So, I need something like read-only access to that member for the purpose of showing it on UI, For example: class A { B b; void doSomething() { b.update(); } } class B { String getTitle() { return title; } Items getItems() { return items; } void update() { ... } } interface SomeView { void show(Items items); } The quick-and-dirty solution would

Aggregate root invariant enforcement with application quotas

ぐ巨炮叔叔 提交于 2020-01-05 04:57:13
问题 The application Im working on needs to enforce the following rules (among others): We cannot register a new user to the system if the active user quota for the tenant is exceeded. We cannot make a new project if the project quota for the tenant is exceeded. We cannot add more multimedia resources to any project that belongs to a tenant if the maximum storage quota defined in the tenant is exceeded The main entities involved in this domain are: Tenant Project User Resource As you can imagine,

How to adapt the Specification pattern to evaluate a combination of objects?

孤人 提交于 2020-01-04 14:40:49
问题 I know that the Specification pattern describes how to use a hierarchy of classes implementing ISpecification<T> to evaluate if a candidate object of type T matches a certain specification (= satisfies a business rule). My problem : the business rule I want to implement needs to evaluate several objects (for example, a Customer and a Contract). My double question : Are there typical adaptations of the Specification patterns to achieve this ? I can only think of removing the implementation of

Is a Person an aggregate root?

谁说我不能喝 提交于 2020-01-04 03:51:25
问题 Since all entities have a stamped of who created/modified the record, can we consider a Person entity an aggregate root to all entities? That is, all entities that references the Person will become a collection to Person, e.g. public class Person { public virtual int PersonId { get; set; } public virtual string Lastname { get; set; } public virtual IList<OrderHeader> CreatedOrders { get; set; } public virtual IList<OrderHeader> ModifiedOrders { get; set; } // Other entities that have a