rich-domain-model

Unit Testing Rich Domain Model

一个人想着一个人 提交于 2020-01-24 18:59:33
问题 This was the anemic domain model: public partial class Person { public virtual int PersonId { get; internal protected set; } public virtual string Title { get; internal protected set; } public virtual string FirstName { get; internal protected set; } public virtual string MiddleName { get; internal protected set; } public virtual string LastName { get; internal protected set; } } And this is its behavior: public static class Services { public static void UpdatePerson(Person p, string

Rich vs Anemic Domain Model

亡梦爱人 提交于 2019-12-17 15:03:22
问题 I am deciding if I should use a Rich Domain Model over an Anemic Domain Model, and looking for good examples of the two. I have been building web applications using an Anemic Domain Model, backed by a Service --> Repository --> Storage layer system, using FluentValidation for BL validation, and putting all of my BL in the Service layer. I have read Eric Evan's DDD book, and he (along with Fowler and others) seems to think Anemic Domain Models are an anti-pattern. So I was just really wanting

Using app-level settings in rich domain models

限于喜欢 提交于 2019-12-11 21:28:02
问题 I want to have a global/app level setting that I want to use in my rich domain models. I have a method that does some calculations based on the argument passed. This might not be the best example and might not look like a method belonging to the domain model but I try to keep it simple so you could understand the problem. public decimal Calculate(CalculationMethod calculationMethod) { switch (calculationMethod) { case CalculationMethod.Multiply: return _x * _y; // _x and _y are fields case

Rich vs Anemic Domain Model

Deadly 提交于 2019-11-27 16:50:21
I am deciding if I should use a Rich Domain Model over an Anemic Domain Model, and looking for good examples of the two. I have been building web applications using an Anemic Domain Model, backed by a Service --> Repository --> Storage layer system, using FluentValidation for BL validation, and putting all of my BL in the Service layer. I have read Eric Evan's DDD book, and he (along with Fowler and others) seem to think Anemic Domain Models are an anti-pattern. So I was just really wanting to get some insight into this problem. Also I am really looking for some good (basic) examples of a Rich