domain-driven-design

How to bind a GridView to a list of multiple types?

亡梦爱人 提交于 2019-12-24 04:57:12
问题 I get this error: System.Reflection.TargetException: Object does not match target type. when trying to bind a List<IEvent> where an IEvent can be an appointment, a birthday, or a few other calendar related event types. 回答1: ChanChan, GridView does not support binding to a collection of interfaces, Try redisigning your application to ensure binding only to a collection of concreate classes. The only workaround for this is to use base class (in your case Event) and bind to a collection of

Interfaces for Rich Domain Models

岁酱吖の 提交于 2019-12-24 03:41:06
问题 Should Rich Domain Models have interfaces to assist with isolation during unit testing (e.g. when testing a service that uses the model)? Or should the Rich Domain Model behaviour be involved in any related unit tests? Edit: By Rich Domain Model I'm specifically referring to domain entities that contain logic (i.e. non-anaemic). 回答1: Usually, the Domain Model is the part that you should keep isolated from everything else. The Domain Model may use interfaces so that it's isolated from external

Swap out repositories with a flag

断了今生、忘了曾经 提交于 2019-12-24 03:18:35
问题 I have an IRepository< T > interface with many T's and several implementations (on-demand DB, web service, etc.). I use AutoFac to register IRepository's for many T's depending on the kind of repository I want for each T. I also have a .NET-caching-based implementation that looks for T's in cache and then calls a 'real' IRepository.Find to resolve a cache miss. It is constructed something like this: new CachingRepository(realRepository, cacheImplementation); I would like to use a

Composing several bounded contexts in DDD

会有一股神秘感。 提交于 2019-12-24 01:08:56
问题 We're developing a comprehensive domain model encompassing 7(!) models/bounded contexts spanning several teams. We are yet to decide whether each one of the BCs is entirely disconnected from the others (being orchestrated by a layer above) or whether they are going to communicate via domain-events. The application under development is for all purposes a SWT/Swing single-threaded application, so no fancy distributed mumbo jumbo between the different BCs is needed. Yet, a big question remains:

How to handle (partially) dependant aggregate roots?

耗尽温柔 提交于 2019-12-24 00:42:44
问题 I have domain concept of Product . Product have some GeneralDetails , lets say: sku, name, description . At the same time, Product have some ProductCalculations part where accountants can put different values like purchasePrice, stockLevelExpenses, wholeSalesPrice, retailPrice . So, so far, Product would look something like: class Product{ GeneralDetails Details; ProductCalculations Calculations; ChangeDetails(GeneralDetails details){} Recalculate(ProductCalculations calculations{} } This

WCF serialization and Value object pattern in Domain Driven Design

限于喜欢 提交于 2019-12-24 00:41:43
问题 The book Domain Driven Design by Eric Evans describes pattern called value object. One of the important characteristics of a value object is that it is immutable. As an example I have a value object "Clinic" which must have a name and an id. To make it a value object I do not provide setters on name and id. Also to make sure that there is not invalid instance I take name and id in a constructor and do not provide at parameter less constructor. public class Clinic { public Clinic(string name,

Domain Driven Design: Aggregate roots with large collections

左心房为你撑大大i 提交于 2019-12-23 17:33:41
问题 I was wondering how I would handle aggregate roots that contain collections with a lot of entities. Like: public class AggregateRoot { public ICollection<Child> Children { get; set; } // 10.000 entities } How would I query the child collection to get specific children? I am using Nhibernate btw. 回答1: You can use Nhibernate's collection filters for this, see this similar question for examples. 来源: https://stackoverflow.com/questions/3958107/domain-driven-design-aggregate-roots-with-large

How to properly map between persistence layer and domain object

折月煮酒 提交于 2019-12-23 16:44:40
问题 Let's say I have a domain java class representing a person: class Person { private final String id; // government id private String name; private String status; private Person(String id, String name) { this.id = id; this.name = name; this.status = "NEW"; } Person static createNew(String id, String name) { return new Person(id, name); } void validate() { //logic this.status = "VALID"; } public static final class Builder { private String id; private String name; private String status; private

How to properly define an aggregate in DDD?

旧街凉风 提交于 2019-12-23 13:39:20
问题 What would be a rule of thumb when designing an aggregate in DDD? According to Martin Fowler, aggregate is a cluster of domain objects that can be treated as a single unit. An aggregate will have one of its component objects be the aggregate root. https://martinfowler.com/bliki/DDD_Aggregate.html After designing aproximatelly 20 DDD projects I am still confused about the rule of thumb when choosing domain objects that would create an aggregate. Martin Fowler uses order and line-items analogy

How to make POCO work with Linq-to-SQL with complex relationships in DDD

人走茶凉 提交于 2019-12-23 13:15:17
问题 I am struggling to find a way to make POCOs work with Linq-to-Sql when my domain model is not table-driven - meaning that my domain objects do not match-up with the database schema. For example, in my domain layer I have an Appointment object which has a Recurrence property of type Recurrence. This is a base class with several subclasses each based on a specific recurrence pattern. In my database, it makes no sense to have a separate AppointmentRecurrences table when there is always a one-to