ddd-repositories

DDD and Asynchronous Repositories

We're working on a rich client (written in Flex) that is connected to a Java backend, using both RMI and JMS. I was thinking about implementing the client in a DDD fashion so that it has Repositories for the CRUD operations on the domain objects. The problem is however that all backend communication happens asynchronous and there is no ...

Domain Driven Design - Logical Deletes

So, I have a nice domain model built. Repositories handle the data access and what not. A new requirements has popped up that indicates that reasons need to be logged with deletes. Up until now, deletes have been fairly simple => Entity.Children.Remove(child). No internal change tracking was happening as my ORM tool was handling stat...

Is there a perfect code generation tool to generate MVC Storefront?

Does anybody know a good code generation tool (other than Subsonic because it doesn't support IQueryable in current version) to generate repository and other projects in a way Rob Conery worked in MVC Storefront? ...

Problem using LINQ to SQL with one DataContext per atomic action

I have started using Linq to SQL in a (bit DDD like) system which looks (overly simplified) like this: public class SomeEntity // Imagine this is a fully mapped linq2sql class. { public Guid SomeEntityId { get; set; } public AnotherEntity Relation { get; set; } } public class AnotherEntity // Imagine this is a fully mapped linq2sql c...

Repository Pattern: how to Lazy Load? or, Should I split this Aggregate?

I have a domain model that has the concept of an Editor and a Project. An Editor owns a number of Projects, and a Project has not only an Editor owner, but also a number of Editor members. Therefore, an Editor also has a number of "joined" Projects. I am taking a DDD approach to modelling this and using the Repository pattern for pers...

When working with domain models and POCO classes, where do queries go?

I am new to domain models, POCO and DDD, so I am still trying to get my head around a few ideas. One of the things I could not figure out yet is how to keep my domain models simple and storage-agnostic but still capable of performing some queries over its data in a rich way. For instance, suppose that I have an entity Order that has a ...

Where do all "bulk" operations belong in DDD?

In DDD one of the key concepts is Repository, which allows you to retrieve Entities (or Aggregate Roots) and then save them back after they are updated. Let assume that we need to perform some 'bulk' operation with entities, and the number of entities makes it absolutely impossible to retrieve them into memory. I.e. operation can only b...

Question about Repositories and their Save methods for domain objects

I have a somewhat ridiculous question regarding DDD, Repository Patterns and ORM. In this example, I have 3 classes: Address, Company and Person. A Person is a member of a Company and has an Address. A Company also has an Address. These classes reflect a database model. I removed any dependencies of my Models, so they are not tied to a...

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...

DDD: Where is it most appropriate to get a list of value objects

I've got a value type called "Product Type" that is assigned to a product. (A product has one product type) To allow the user to select the type from a list, I'm going to fill a dropdown. Where is it most appropriate to retrieve the list of product types? A class implementing a repository pattern? Edit: Clarified by changing product ...

Repository pattern and data type returned...

I am using the repository pattern and was wondering about what data type I should return. In my database I have a string that is variable length that needs to be broken up based off of fixed lengths. I was initially thinking of passing out the string and letting the service layer do the parsing based on the lengths of the configured co...

In DDD, are collection properties of entities allowed to have partial values?

In Domain Driven Design are collection properties of entities allowed to have partial values? For example, should properties such as Customer.Orders, Post.Comments, Graph.Vertices always contain all orders, comments, vertices or it is allowed to have today's orders, recent comments, orphaned vertices? Correspondingly, should Repositori...

DDD - Repository Pattern returning db keys?

There is a big design flaw here, but I'm having trouble solving it: The business need is a little involved so I'll try to keep this simple. We have a table with purchases, and a table for returns. When a return is made, we have to find match that return to the oldest purchase in the db, and record that in a "returns applied" table. So,...

Repository without ORM for saving object graph

I know it's fairly straight forward to create Repository for retreiving domain models without ORM (http://stackoverflow.com/questions/446629/repository-pattern-without-linq-or-other-orm). However, what about saving domain models and its internal object graph? public class Car: IAggregateRoot, IEntity, ICar { public IEnumerable<IWheel>...

CRUD over aggregate root using traditional ado.net

Can anyone show me simple CRUD statements for aggregate root using traditional ado.net? Thanks in advance! ...

Facebook Connect + MVC Model

Hey everyone, I am working on an ASP.NET MVC project and I am trying to get it integrated with facebook by using facebook connect API. Now, I am having a small problem in imagining how the conceptual layout would be. I am using the repository model in MVC, I have my own DB. I want to be able to fetch user’s information from FB, and may...

DDD Repository Awareness of Other Repositories

Is it generally acceptable that one repository can access another repository? Specifically in this case, I have one aggregate root that uses another aggregate root to determine what entities to add. It falls along the lines of an Item/Item Type relationship. The reason that the Item Type is an aggregate root is that they are separatel...

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...

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...

Detecting Changes in Entities within an Aggregate Root

I am looking to see what approaches people might have taken to detect changes in entities that are a part of their aggregates. I have something that works, but I am not crazy about it. Basically, my repository is responsible for determining if the state of an aggregate root has changed. Let's assume that I have an aggregate root calle...