ddd-repositories

How do I implement repository pattern and unit of work when dealing with multiple data stores?

I have a unique situation where I am building a DDD based system that needs to access both Active Directory and a SQL database as persistence. Initially this wasnt a problem because our design was setup where we had a unit of work that looked like this: public interface IUnitOfWork { void BeginTransaction() void Commit() } and o...

Domain driven design value object, how to ensure a unique value

Hi, I am building a questionnaire creator. A questionnaire consists of sections, sections consist of pages and pages consist of questions. Questionnaire is the aggregate root. Sections, pages and questions can have what are called shortcodes which should be unique within a questionnaire (but not unique within the database hence they ar...

DDD and MVC Models hold ID of separate entity or the entity itself?

If you have an Order that references a customer, does the model include the ID of the customer or a copy of the customer object like a value object (thinking DDD)? I would like to do ths: public class Order { public int ID {get;set;} public Customer customer {get;set;} ... } right now I do this: public class Order { ...

Book suggestion on this DDD concept specific to ASP.NET MVC and JSON?

I am looking for a book or blog entry on the following DDD concepts, something specific to MVC and C# code. Quick summary: partially populated domain models from special repository methods and sending only changed domain model properties as JSON back from the client. More details: If you have a Customer object but need a drop down li...

DDD: Repositories are in-memory collections of objects?

I've noticed Repository is usually implemented in either of the following ways: Method 1 void Add(object obj); void Remove(object obj); object GetBy(int id); Method 2 void Save(object obj); // Used both for Insert and Update scenarios void Remove(object obj); object GetBy(int id); Method 1 has collection semantics (which is...

Can the domain model and repositories be in seperate dlls?

Can the domain model and the repositories be in separate dlls? In a 3 tier architecture I guess I would put the domain model in the business layer and the repositories in the data access layer. I get confused as it is my understanding that the domain model uses the repositories while the repositories should return objects from the doma...

Organize Project Solution w/ Interfaces for Repository

VS 2010 / C# Trying to organize a solution and looking for options for naming the project that will host the interfaces for the repository. I have: MyProject.Domain MyProject.WebUI MyProject.Repositories MyProject.Interfaces?? So far "Interfaces" is the best name i've come up with, but I don't like it. Any ideas/suggestions? ...

Which layer should Repositories go in?

Which layer should the repository classes go in? Domain or Infrastructure? ...

Where to put object-oriented queries in a layered architecture?

Given: You have an architecture with the layers presentation, business and data. You are applying domain-driven design. You are using an object-relational mapper that lets you create object-oriented queries (e.g., NHibernate which lets you create HQL queries). Question: Into which layer should you put the object-oriented queries? M...

Flatten out complex Domain hierarchy using discriminator

Hi All Short Summary : I am using DDD approach to design my domain. This resulted in a very deep object hierarchy in my domain. My ORM tool is hibernate. As we all know that hibernate provide various means of modeling inheritance. Initially i used table per subclass hierarchy to realize this complex domain and very soon i ran into perfo...

DDD - Enity Framework 4 and ncommon

I'm trying to get EF4 working with ncommon 1.1 which provides DDD patterns such as UnitOfWork, Specification, Repository. The NCommon configuration line is throwing the following Exception: SynchronizationLockException occurred Object synchronization method was called from an unsynchronized block of code. The actual code throwing the...

JPA & DDD: how to implement side effects of entity deletes and inserts

I am building an application under DDD architecture, thus I have implemented rich domain objects that can also be entities. These entities can also have full access to (injected) repositories that can do add & remove operations on other objects/entities. So far, this all works without any problems. But can side effects for objects/entit...