domain-driven-design

Fluent NHibernate : How to map a 'Foreign Key' column in the mapping class

I'm starting to develop with Fluent NHiberate, and I was wondering how I create a defined 'Foreign Key' relationship in my Mapping class. Here's my class. These classes are a one-to-one with associated tables. public class Song { public virtual int SongID{ get; private set; } //Primary Key public virtual int SongArtistID { get...

What's the benefit of using another model with Entity Framework in DDD

When looking at some application designs for DDD, I see that the objectgenerated from the entity framework are only used to access the data store. Once the data is loaded it's mapped to another POCO object defined in the model of the application. Is this just good design and is done for the sake of design? Or is there some added value ...

How can I model this object hierarchy in Fluent NHibernate without violating DDD principles?

I am trying to build a domain model that will allow me to manage Contracts. The Contract class is my aggregate root, and it has a single property right now, which is Reviewers. Reviewers, in the context of the Contract, each have a property to it's parent Contract, and a First Name, Last Name, and Login. The reason they have these pro...

When is domain-driven design adequate?

Most books about DDD talk about aligning the tech to the business. So you have orders and payment business rules and such. What if I write a technological applicaiton. For example if I author a visual studio like app. Is DDD not relevant, or can I say that my domain is "application development" and identify the players ("solution", "fil...

Is this the correct way to instantiate an object with dependencies from within a Domain Model?

I'm trying to avoid ending up with an anaemic Domain Model, so I'm attempting to keep as much logic as possible within the domain model itself. I have a method called AddIngredient, which needs to add a new KeyedObject to my Recipe Aggregate. As the Domain Models themselves are meant to be devoid of repositories, I'm getting the ingredi...

Setters in Domain Model

Hi, In the context of DDD setters on a domain model are a code smell. They should be avoided for the simple reason that they are not really part of the domain. There are no nouns in it that a Domain Expert may understand and changes to the data should go through specific methods instead. Example: customer.StreetName = ... customer.C...

How to track Domain Entities with TFS using the CMMI project template?

My enterprise is about to start a somewhat complex project in which we will probably use Domain Driven Design for the business layer. The project will be developed using Visual Studio 2010, and managed via TFS 2010 using the CMMI 5.0 team project template. I think that it would be a good idea to use TFS work items to track and manage th...

DDD along with collections

Hi, suppose I have a domain classes: public class Country { string name; IList<Region> regions; } public class Region { string name; IList<City> cities; } etc. And I want to model this in a GUI in form of a tree. public class Node<T> { T domainObject; ObservableCollection<Node<T>> childNodes; } public class Countr...

From MVC to MVVC

I don't want to store my domain model classes in the same assembly as my web platform. The Models folder in the project structure is therefore useless to me. I've however just finished the Music Store Tutorial and noticed how they create a "ViewModels" folder which makes lots of sense to me. Does it make sense to just treat the Models...

Sample database schema + domain model for trying out an ORM

Is there a (freely available) sample of a DDD domain model with an accompanying schema that makes use of several ORM features (inheritance, value types, etc) that could be used to test an ORM? It's easy to create a simple Order/OrderItem schema, but that never prepares you for the intricacies down the road. (I'm coming at this from a ....

Code Generation - Domain/model first (DDD)

I'm looking for a 'complete' solution for code-generation based on DDD or model first approach. Ideally, this would be a separate application or VS plugin that we could use and re-use to generate as much of the standard plumbing code as possible, preserving my custom business logic as well. I would like to generate VS projects, includin...

Rhino.Security; Domain vs Application Service Options

Should I consider Rhino.Security components to be part of the domain layer, used by other domain entities, or should it be used by the Application layer? For example, I have a system where an administrator can create new user accounts. By default these new user accounts should have the following security settings: Associated wit...

Binding DropdownList in Domain Driven Design

I have created domain model and define entities, value objects, Services and so on. Now, my query is that i have an entity called "Company" which has around 20+ attributes and i want to bind a dropdownlist control in one of my page that require only two attributes i.e. company.Name, company.Id. Why should i use such a heavy entity having...

Changing the discriminate-column in a single table sub class with JPA inheritance

I have a domain model that looks like this: Instruction | \ Money Other / \ Unit Cash and I want to map this model to my DB using JPA. All classes map to the same table in the DB, (T_INSTRUCTION). So I started out with jpa's SINGLE_TABLE inhertance strategy. Separating the Money and Other classe...

When doing DDD, are there any best practices in using copy on set or copy on get, or both?

Domain Driven Design (DDD) suggests using immutable objects or to copy object state when moving data around. I see both good reasons for copying when setting data and when getting data. Take the following interfaces and pretend they have implementations: interface Aggregate { function setEntity($e); function getEntity(); } in...

Domain Event Design Pattern

I've been reviewing an example of domain event design blogged about recently by Mike Hadlow and created originally by Udi Dahan. Currently we are publishing static events on our domain objects and subscribing to them directly within our services, or via our plugin model (we locate and initialize our plugins at runtime using StructureMap...

How to map object table with database table using system.data.linq.datacontext in Domain driven design approach

I m applying domain driven design in my existing application using generic repository pattern in Linq2SQL,For this i m having an abstract entity class with common properties to be inherited by my other object tables,i m using structure Map for Dependency Injection.For saving and mapping my object tables to database tables i m using Syst...

The place of Entity framework 4.0 + POCO + WCF in DDD "world".

I'm trying to get to light. In DDD approach we have Presentation Layer(UI), Application Layer(Application Services), Domain Layer and Infrastructure. I'm sure that anyone knows o short description on those 4 layers. I know WCF feet in Application Layer(Application Services), and the Entity Framework .edmx model in Infrastructure Layer....

DDD vs N-Tier (3-Tier) Architecture

I have been practicing DDD for a while now with the 4 distinct layers: Domain, Presentation, Application, and Infrastructure. Recently, I introduced a friend of mine to the DDD concept and he thought it introduced an unnecessary layer of complexity (specifically targeting interfaces and IoC). Usually, its at this point, I explain the b...

Domain Driven Design Aggregates

Can someone please clarify the following; if a have the following model; presentation-->slide-->video where I have identified presentation as the aggregate root, does this mean that if I want to add a slide to a presentation then I must go through the aggregate root e.g. presentation.addslide(slide myslide) and in a similar fashion if...