domain-driven-design

DDD confused with Repository Pattern and Reports

I am new to DDD and the Repository pattern, so my understanding of it might be totally wrong. But I am trying to learn it. Having said that I need to create an application, which shows the zones of a store. I create a ZoneRepository for that purpose, which works so far with my few methods. Now in that application I also need to show the ...

How to fluent-map this (using fluent nhibernate)?

I have two tables in my database "Styles" and "BannedStyles". They have a reference via the ItemNo. Now styles can be banned per store. So if style x is banned at store Y then its very possible that its not banned at store Z or vice verse. What is the best way now to map this to a single entity? Should I be mapping this to a single entit...

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

asp.net MVC ddd DRY vs loose coupling and persistance/data access layer

So as I understand it with good loose coupling I should be able to swap out my DAL with a couple lines of code at the application root. I have 2 DAL written, Linq-to-sql and a JSon file repository (for testing and because I wanted to try out the System.Web.Scripting.JavascriptSerializer). linq to sql will create entities instead of my ...

ASP.MVC: Repository that reflects IQueryable but not Linq to SQL, DDD How To question

I want to create a DDD repository that returns IQueryable Entities that match the Linq to SQL underlying classes, minus any relations. I can easily return Entities minus the relations with a Linq select new {field, field, ... } projection. How do I code the Repository Entity class? How would I return an object from the repository havi...

Using IoC to resolve dynamically loaded types

I've written a program using Domain Driven Design in .NET 2.0 and I'm trying to implement a plugin framework for it. I've implemented several types of plugins: Domain Plugin A domain aggregate composed of one or more domain classes One or more View/Presenter pairs to display instances of the aggregate An import/export service specif...

Accessing domain objects in the view

If I don't want to expose the internal state of my Domain Objects, but I need to display them, I can think of three approaches. Which of these is the most "correct" (if any?). The "DTO/ViewModel approach". This seems to be a popular approach in the ASP.NET MVC world (especially with the use of AutoMapper). The "decorator approach". I...

Relations in your model in a MVC application?

Now I have an model User which represents an user in the application. And I use an UserRepository with methods like getById($id) and getAll(). An user can post reviews. If I want to show the 5 or 10 or maybe 20 last reviews of an user it's most logical to ask the user I think. So I would have a method $user->getLastReviews(5). But wha...

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

While designing ORM, what is the best approach to represent relationship, performance-wise ?

While designing ORM, what is the best approach to represent the relationship, performance-wise? I mean, out of the following two, which approach is best considering performance? class Employee { int ID { get; set; } String Name { get; set; } int DepartmentID { get; set; } //This approach uses DepartmentID } --- OR ---...

Best resource for learning and seeing examples of Behavior Driven Development (BDD)

Hi, I am trying to creating Cucumber/Gerkin BDD Feature and Scenario descriptions, and am seeking examples just at the domain specific language. In particular, examples and suggestions to make sure I cam covering corner conditions, clear examples so we are following best practices and approaches, to make sure both developers and BA's a...

Is using a table inheritance a valid way to avoid using a join table?

I've been following a mostly DDD methodology for this project, so, like any DDD'er, I created my domain model classes first. My intention is to use these POCO's as my LINQ-to-SQL entities (yes, they're not pure POCO's, but I'm ok with that). I've started creating the database schema and external mapping XML file, but I'm running into som...

Domain Driven Design efforts in dynamic languages ?

Are you aware of any DDD efforts in a dynamic language ? Practical resources on DDD tend to decrease quite dramatically when straying from enterprise-oriented solutions (a google search exluding C#, .NET, ASP and Java yields 10 times less results), but i couldn't actually find a single example of a DDD implementation in a dynamic langua...

DDD Advice regarding related Objects (C#)

I am on the fence about this question. Is it better to hold a collection of IDs related to an object or a collection of the object relation. I plan to use a repository approach as well. Here is what I mean: public class Person { string PersonName {get; set;} List<PersonFriend> PersonFriends {get; set;} { or... public class P...

IoC Containers and Domain Driven Design

I've been searching for guidance for using IoC containers in domain driven design. Evan's book unfortunately doesn't touch on the subject. The only substantial guidelines I could find on the internet is here. Many of Malovic's points are common sense but I'm concerned about a few of them. He suggests that IoC container's should be reser...

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

DDD - Returning entity in response to a service operation

I am new to domain driven development & have a simple question. If a service needs to generate some entity as a response to an operation then how should it be done? One of the ways is to inject entity factory in the service instance. Is there any other better solution for the same ? Thanks & regards ...

How do you deal with linktables when using Domain Driven Design and nHibernate?

If you have the tables Groups, Users, Channels and between each two a linktable, how do you organize that in Domain Driven Design and nHibernate? Does a Group have a UserCollection and a ChannelCollection, a User a GroupCollection and ChannelCollection and a Channel a GroupCollection and UserCollection? And if you want to add a Group to...

Can/Should a domain object be responsible for converting itself to another type?

We have a class Event (it's actually named differently, but I'm just making abstraction): public class Event { public string Name { get; set; } public string Description { get; set; } public EventType EventType { get; set; } } We need to build an instance of a Message class with this object, but depending on the EventType,...

How do you deal with composite pattern when using hibernate and domain-driven design?

Does hibernate has support for hierarchical data in a database where you use a parentId you use a parentId and an orderId you use Modified Preorder Tree Traversal ...