ddd-repositories

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

Questions regarding Domain driven Design

Hi All, After reading Eriv Evan's Domain driven design also i have few doubts. I searched but no where i could able to find satisfying answers. Please let me know if anyone of you have clear understanding below questions. My concerns are Repository is for getting already existing aggregates from DB,Web service . If yes, Can Reposit...

Implementing repositories using NHibernate and Spring.Net

I'm trying to get to grips with NHibernate, Fluent NHibernate and Spring. Following domain-driven design principals, I'm writing a standard tiered web application composed of: a presentation tier (ASP.Net) a business tier, comprising: an application tier (basically a set of methods made visible to UI tier) repository interfaces and d...

repository pattern with a legacy database and Linq to SQL

I'm building an application on top of a legacy database (which I cannot change). I'm using Linq to SQL for the data access, which means I have a (Linq to SQL) class for each table. My domain model does not match with the database. For example, there are two tables named Users and Employees, and therefore I have two Linq to SQL classes n...

DDD screen cast question?

I wathced a screen cast on DDD by Greg Young the other day which spoke about persisting all state transitions of an object, instead of it's state when saved, then to load it "replay" all these messages to get the current state back.. This seemed like a really interesting idea, but I'm stuck as to what this particular thing is called! I'd...

How does an aggregate root delete one of its children?

If my understanding of Aggregate Roots is correct, the root should be responsible also for deleting one of its "children". That would seemingly translate into something like this: order.removeOrderLine(23); Which would effectively remove it from the collection. However, how is this persisted? Is my ORM's UnitOfWork supposed to detect ...

Database performance with Nhibernate and Activerecord

Inspired by the DDD hype, I designed my classes pretending there was no database at all. And then used NHibernate to map the classes to database tables. Part of my class graph look like this: Order (hasmany)--> Product (belongsto)-->Seller. To retrieve all orders placed for a certain seller. I have the code: public class Order:ActiveRec...

What's an Aggregate Root?

I'm trying to get my head around how to properly use the repository pattern. The central concept of an Aggregate Root keeps coming up. When searching both the web and Stack Overflow for help with what an aggregate root is, I keep finding discussions about them and dead links to pages that are supposed to contain base definitions. In the...

Simple Repository Question about Filtering and Sorting

I have a list of products coming from a repository. Simple enough. Now I want to add filtering and sorting. Sorting could happen outside of the repository since there are no efficiency gains doing them inside the repository (guess). I couldn't imagine doing filtering outside of the repository since we only want to load records we car...

DDD - How to implement performant repositories for searching.

Hello, I have a question regarding DDD and the repository pattern. Say I have a Customer repository for the Customer aggregate root. The Get & Find methods return the fully populated aggregate, which includes objects like Address, etc. All good. But when the user is searching for a customer in the UI, I just require a 'summary' of the ...

LINQ2SQL, Persistence Ignorance and Domain Models

Has anyone here have used LINQ to SQL to support the persistence of domain models? I'm not planning to use the LINQ2SQL entity designer, just plain-old hand-coded XML mapping and I'm currently having roadblocks. I'm attempting to use it in a DDD example I'm doing, since my audience only knows LINQ2SQL. ...

Approach for a (generic) DDD Repository with JPA/Spring: does it look wrong?

I'm pretty new to DDD and JPA. I'm working on a generic Repository with JPA and Spring. I really like the approaches exposed in the articles DDD: The Generic Repository and JPA implementation patterns: Data Access Objects. My aim is to build the perfect Repository in Domain-Driven Design with JPA and Spring. I use an internal generic R...

How do I effectively use SQLAlchemy with multiple DDD Repositories?

I have been trying to find some examples of how to implement the Repository pattern with SQLAlchemy. Specifically, implementing more than one Repository. In the case of multiple Repositories, I believe each Repository would be best implemented by maintaining a separate SQLAlchemy session. However, I have been running into a problem tryi...

Applying DDD to Northwind database

Hello, I would like to do some exercice and apply DDD to my Domain Model applied to Northwind database. Even if Northwind is an example I imagine that it was done to satisfy some " virtual business" requirements. So the goal is to have a Domain Model that respects DDD and the data is stored in Northiwnd database. Consider this EF persi...

DDD: Trying to code sorting and filtering as it pertains to Poco, Repository, DTO, and DAO using C#?

I get a list of items from my Repository. Now I need to sort and filter them, which I believe would be done in the Repository for efficiency. I think there would be two ways of doing this in a DDD way: Send a filter and a sort object full of conditions to the Repository (What is this called)? Repository result would produce an object...

What is the best way to use EF 4 and DDD

I would like to use EFf 4 as my ORM in my DDD project. I am going to generate my model based on my classes. Should I create classes that are basically dto objects for my business objects to consumer or should I implement the actuall BO classes in my EF model? ...

Linq to Sql, Repositories, and Asp.Net MVC ViewData: How to remove redundancy?

Linq to SQL creates objects which are IQueryable and full of relations. Html Helpers require specific interface objects like IEnumerable<SelectListItem>. What I think could happen: Reuse the objects from Linq to SQL without all the baggage, i.e., return Pocos from the Linq to SQL objects without additional Domain Model classes? Extrac...

ASP.NET MVC: what mechanic returns ViewModel objects?

As I understand it, Domain Models are classes that only describe the data (aggregate roots). They are POCOs and do not reference outside libraries (nothing special). View models on the other hand are classes that contain domain model objects as well as all the interface specific objects like SelectList. A ViewModel includes using Sy...

How to keep your unit tests simple and isolated and still guarantee DDD invariants ?

DDD recommends that the domain objects should be in a valid state at any time. Aggregate roots are responsible for guaranteeing the invariants and Factories for assembling objects with all the required parts so that they are initialized in a valid state. However this seems to complicate the task of creating simple, isolated unit tests a...

ASP.NET MVC 2: Mechanics behind an Order / Order Line in a edit form

In this question I am looking for links/code to handle an IList<OrderLine> in an MVC 2 edit form. Specifically I am interested in sending a complete order to the client, then posting the edited order back to an object (to persist) using: Html.EditorFor(m => m.orderlines[i]) (where orderlines is an enumerable object) Editing an Order th...