domain-driven-design

MVC-ish : Who is responsible for loading the data?

I just got out of a small project and I've tried to follow a somewhat domain-driven design (well, what I think it is...). I've struggled a bit were some of my domain class started to need to load something. I'm not sure this is the right place for it. Let's take for example a boring image slideshow. For my domain classes, I would define...

DDD Infrastructure services

Hello, I am learning DDD and I am a little bit lost in Infrastructure layer: As I understand, "all good DDD applications" should have 4 layers: Presentation, Application, Domain and Infrastructure. Database should be accessed using Repositories. Repository interfaces should be in Domain layer and repository implementation - in Infrastru...

Performance of this structure?

Hi everyone, I want to take your opinion about the performance of the following architecture which I have in an ASP.NET MVC project I am working on. Thanks! ...

Can I access a repository from presentation layer?

Hi, I am starting with DDD. I am a bit confused with the interaction between the several layers involved in a DDD application. Can I call my repositories from my presentation layer? If not do I have to replicate the CRUD functionality provided by the repositories in my service layer (which ofcourse will in turn use the repository for ...

How linq 2 sql is translated to TSQL

Hi all, It seems Linq2sql doesn't know how to construct the TSQL while you transform linq2sql object into domain object with constructors. Such as: from c in db.Companies select new Company (c.ID, c.Name, c.Location).Where(x => x.Name =="Roy"); But when using settable attributes, it will be OK. from c in db.Companies select new Comp...

Specification Pattern vs Spec in BDD

I'm trying to explore Behavior Driven Design and Domain Driven Design. I'm getting that written specifications drive the tests in BDD, but also that business logic can be encapsulated using the specification pattern for re-use in domain objects and repositories, etc. Are these basically the same concept just used in different ways, use...

Best way to implement Repository Pattern?

I've been exploring BDD/DDD and as a consequence trying to come up with a proper implementation of the Repository pattern. So far, it's been hard to find a consensus over the best way to implement this. I've tried to boil it down to the following variations, but I'm unsure which is the best approach. For reference I'm building an ASP.MV...

Unit Testing Domain Services Against a Real Database

I was wondering what approaches others might have for testing domain services against a database? I already have a series of mock repositories that I am able to use in the domain services for testing the domain services themselves. Part of the construction of these mock repositories is that they build out sample aggregates and associat...

Anaemic domain models or "where to put logic"

This is one of those scenarios where "Paralysis by Analysis" seems to have taken hold so advice please! The project A fairly simple list of automotive products which include details such as part reference, which vehicles they fit etc. The front end is an asp.net MVC application. The backend is SQL, using Subsonic to project the produ...

Domain Model Design

How would you create a domain model for this simple example? A recipe can have many ingredients and an ingredient can be used in many recipes. How much of each ingredient used in each recipe is also stored. I have designed the following three database tables to store this data and the relationships. I am now trying to create a domain mo...

Specification Pattern defined in Domain

Using Linq to SQL, and a DDD style Domain Layer with de-coupled repositories, does anyone have any good ideas on how to implement a specification pattern without bleeding L2S concerns up into the domain layer, that is still understandable? :) We have complex business logic surrounding the selection of a set of transaction data, and woul...

.NET Membership with Repository Pattern

My team is in the process of designing a domain model which will hide various different data sources behind a unified repository abstraction. One of the main drivers for this approach is the very high probability that these data sources will undergo significant change in the near future and we don't want to be re-writing business logic w...

Domain Driven Design Layout Question

Hi Im new to the DDD thing. I have a PROFILE class and a PROFILE REPOSITORY CLASS. The PROFILE class contains the following fields -> Id, Description, ImageFilePath So when I add a new Profile, I upload then image to the server and store the path to it in my db. When I delete the profile, the image should be removed from my file syste...

MVC - Linq - Populate List<T> with Records in Another Table

I'm prototyping my first MVC application, it's a simple forum. I've done part of the domain model and I'm trying to figure out how to do something that's pretty basic in SQL alone, but I can't figure it out in my application. Here are my Entities: [Table(Name="Users")] public class User { [Column(IsPrimaryKey=true, IsDbGenerated=t...

DDD Modeling question

Hi, I have these two structures in my domain: Exercise (with subjects, solution, difficulty ext.) and Subject which has a name and a father subject. Subject is defined by its attributes so in that sense it's a value object, However even if my current data store has nothing associated with a particular subject, that subject existence sti...

NHibernate: "failed to lazily initialize...", DDD approach

Hello, I'm trying to set up NHibernate in an ASP.NET MVC application using a DDD approach. However, I do get an error when trying to lazy load an objects related entity. Heres how I've structured my application: Infrastructure layer: Contains mapping files, repository implementations and a NHibernate bootstrapper to configure and build...

Possible ways to return a subset of data from Repository<T>?

Let's say I need to display a list of customers, but only want to display the Name and somehow associate the key to the name within a list control. It would probably be costly to retrieve the entire list of customers and all it's properties. In this scenario, would it be better to create another class with the properties that are req...

Completely new to domain modeling, don't know where to begin

I'm beginning a new project and I want to start by modeling the data that the client needs to store. However, I have no idea where to begin. So far, I'm trying to model two simple entities, Event and Address. An Event can have multiple Addresses and an Address can be associated with multiple Events. This is what I have: public class Eve...

Domain Driven Design: Aggregate root & Sub Aggregate roots

In my project, i am finding the need to break my aggregate in a hierarchical fashion, with top root level aggregate, which ensures consistency of rules at root level, and then my objects under the root, can be sub grouped into various aggregates. When calculating the integrity of root level aggregate, the root validates it's own rules an...

Domain Driven Design: where does the workflow logic lie?

In my project,i have workflow which operates on multiple entities to accomplish a business transaction. What is the best place to represent the workflow logic? currently i just create a "XXXManager" which is responsible for collaborating with entity objects to conclude a business transaction. Are there other options? ...