domain-driven-design

Is using one-to-one interfaces with domain entities a good or bad practice? Why?

One thing I see in some DDD enterprise apps that I work on, is the use of interfaces that are identical to the domain entities, with a one-to-one mapping of properties and functions. Indeed a domain object is always used through it's one-to-one interface, and all domain entities have a one-to-one interface in this style. For example: ...

DDD saving "same" entity for different context boundaries

This is only an example. Say that you have 2 entities for 2 different context boundaries. The first context is the SkillContexter, the entity is 'Player' and has 3 properties: Id, Name and SkillLevel. In the other context (Contactcontext) the entity is 'Player' and has 3 properties: Id, Name and EMail. How do I persist these entities t...

Is it ok for entities to access repositories?

I've just started working with DDD, so maybe this is a silly question... Is it ok for an entity to access a repository (via some IRepository interface) to get a value at runtime? For example, I want to enforce a "default" selection for a property: class Person { private Company _employer; public Company Employer { get...

How to get my SQL DB to match my Domain Driven Design

Okay, I'll be straight with you guys: I'm not sure exactly how Domain Driven my Design is, but I did start by building Model objects and ignoring the persistence layer altogether. Now I'm having difficulty deciding the best way to build my tables in SQL Server to match the models. I'm building a web application in ASP.NET MVC, although ...

Where can I find information on Authentication and Authorization in the context of Domain Driven Design ?

I'm trying to do things the DDD (domain driven design) way. And boy do I struggle. In all books I read, Authentication is of no concern and not mentioned! I've written my own Authentication and Membership Service which are responsible for registering and logging in users, creating salted passwords etc. I do not use .NET's Membership Pro...

What Belongs to the Aggregate Root

This is a practical Domain Driven Design question: Conceptually, I think I get Aggregate roots until I go to define one. I have an Employee entity, which has surfaced as an Aggregate root. In the Business, some employees can have work-related Violations logged against them: Employee-----*Violations Since not all Employees are subject...

Domain modeling hints - Products / sales

I'm currently modeling some domain classes for storing information about products, resellers and payments. Some products can be a typical one-time-payment deal like someone buying an hard drive. Other products may include a service deal with different discounts and payment intervals. The model should cope with changing product prices, ...

Fluent NHibernate Classes as code behind for Domain classes

Ok, so I want to create a code behind for non-aspx classes. I have mapping files (classes) that I want to show in project as a code behind for entites. Is there a way to do that in VS2008. ...

ASP.NET MVC / DDD architecture help

I am creating a Web application using ASP.NET MVC, and I'm trying to use domain-driven design. I have an architecture question. I have a WebControl table to store keys and values for lists so they can be editable. I've incorporated this into my business model, but it is resulting in a lot of redundant code and I'm not sure it belongs t...

Reconstituting domain objects from database: identity problem

We are using Linq to SQL to read and write our domain objects to a SQL Server database. We are exposing a number of services (via WCF) to do various operations. Conecptually, the implementation of these operations consists of three steps: reconstitute the necessary domain objects from the database; execute the operation on the domain ob...

TDD and DDD while still understanding the domain

When you are starting a new project from scratch using DDD, and still isn't very confortable with the domain, TDD comes at a price. While you're still understanding the details of the domain, you figure out a lot of stuff you've done wrong, like a method that makes more sense in some other class, or adding/removing parameters from a cons...

How should i lazy-generate a thumbnail image?

For background, i have a Data layer and Service layer loosely based on Rob Conery's Storefront model and like Rob's, many of my domain objects and chained with LazyList<>'s and LazyItem<>'s to make use of the deferred execution that Linq2Sql provides given that my Lazy* types utilise IQueryable<T> rather than this awesome delegate approa...

DDD: Primary keys (Ids) and ORMs (for example, NHibernate)

Why is it considered OK to have an Id field in the domain entities? I have seen several solutions that provide base class with Id and Id-based GetHashCode/Equals. My understanding of domain model is that it should contain only things related to the domain. While in rare cases (trackable orders) Ids are meaningful, most of the time they ...

Maximum 'Units of Work' in one page request ?

Its not One is it? I have a method that gets five Lists from different repositories. Each call opens and closes a new Datacontext. Is this ok to do or should I wrap everything in One datacontext. In this case it is not straightforward to use the same datacontext, but i am afraid that opening and closing numerous datacontext in one page ...

generate java domain objects from database table

may i know in eclipse, is there any feature that will auto generate domain objects with all table relationship properly mapped in class? can provide me with some reference articles on this? ...

My ASP.NET MVC application is Anemic.

I read Fowlers description of Anemic Domain and I believe I have those symptoms. I have several objects doing nothing but passing data around in different packages. I also have several Services that pretty much handle all the behavior (executive functioning). I am starting to lose track of why and what i did and where to find certain tas...

DDD. Domain model and logging.

Domain model should be dependency-less. Therefore - it must not contain any reference to logging mechanism. I understand that there are not any problems with logging infrastructure&application layer, but what if i want to log domain model? Is it not supposed to be logged, just unit tested & logged from outside (infrastructure/application...

Mapping Linq-to-Sql entities to custom domain entities

How could I map my Linq-to-Sql generated entities (DTO’s) to my domain entities? The problem is that I can’t map the associations because they are not of the same type. The DTO’s uses EntitySet and EntityRef and my domain entities uses IList and T. I’ve looked at some blog post: Ian Cooper's architecting-linq-to-sql-applications-part-5 ...

How do you weave Authenticaion, Roles and Security into your DDD?

How do you implement Roles and Security in your C# Domain Driven Designs? We have some debate raging on wether it should be implemented by the calling application (ASP.NET MVC) or in the Domain Model itself (model entities and services). Some argue that it should be in the web site itself since that's where the authentication already exi...

How to introduce Domain Driven Design to co-programmers?

Tomorrow i need to show small presentation about DDD approach. It should contain 2 main points: "What is Domain Driven Design?" "How can we use it?" I would be glad if i could see some ideas how to 'implement' first point of my 'presentation interface'. Asking because I'm not making presentations everyday and i`m little bit conf...