domain-driven-design

Factory method signature for aggregate root

I want to write a factory method to instantiate an entity that is an aggregate root. Should the method accept the aggregated child entities and values as instantiated objects, or should it accept only primitive types? For example, if I had an entity Computer composed of a Processor and a Memory object, should the factory method take th...

Questions regarding Entity Framework + DDD

I'm having a difficult time finding straight forward examples of using EF in a DDD style pattern. This is also my first time employing DDD and have a few questions regarding solution layout and how to employ some of the DDD patterns. 1) Most of the examples I've seen regarding using the Repository pattern w/ EF just show specialized Mod...

Tell me what is stupid about my Entity Validation (and how to improve it)

I have an IEntity interface that implements an interface, IValidatable public interface IValidatable { bool IsValid { get; } bool IsValidForPersistence { get; } // Rules applied at UI time (please enter your name, etc) IEnumerable<RuleViolation> GetRuleViolations(); // Rules to be applied only at persistence time ...

Hibernate Immutable Value Object

customer = // get customer from the current hibernate session // customer has a discount with database id of 1 Everything is fine until here. But if I call: discount = SpecialDiscount.create("10%"); customer.setDiscountTo(discount); session.save(customer); // customer has a discount with database id of 2 now How hibernate can updat...

Where to place the code for best practice?

I have an asp.net mvc application and I have a page for presenting meteo information. It looks like: Temperature for today is 34-35 degrees For this 34-35 degrees , I have a method that assure that the text will be in format [Number][Dot][Number] called AssureCorrectDegressFormat(). Now I am asking where is it suited t...

Using NHibernate Collection Filters with DDD collections

I am trying to map a domain model in NHibernate. The domain model is implemented with what I think is DDD style. The mapping works mostly but then when I try to use a collection filter on an a collection I get an exception which says: The collection was unreferenced. I know the problem comes from how I've implemented the collection. My ...

SqlDependency in ASP.NET

Hi, I created the following encapsulation over the SQL Dependency object: public class DependencyTracker { private SqlDependency _SQLDependency = null; public string ConnectionString { get; private set; } public string CommandNotifier { get; private set; } public delegate void Refre...

Domain Objects containing lots of Data

Our Domain has a need to deal with large amounts (possibly more than 1000 records worth) of objects as domain concepts. This is largely historical data that Domain business logic needs do use. Normally this kind of processing depends on a Stored Procedure or some other service to do this kind of work, but since it is all intimately Domai...

Books that will cover TDD, DDD and Design Patterns in .NET

I would like to get book(s) that will really give me a complete view of modern ASP.NET development using C#, TDD, ASP.NET MVC, DDD and Design Patterns such as the Repository pattern. I'm very competent with C# and ASP.NET MVC, but want to fill in the gaps. If you've had a good experience with a book or two that covers these topics coul...

Why wouldn't I want to use BindingList<T> in my domain model classes ?

I am starting to code a fresh domain model. I plan to use NHibernate to persist my classes later on. I am building an application that is mainly used for optimising transportation. My domain model has one important class in in that is called Model, which represents the current situation that I want to optimize. It is basically a contain...

Why would be the drawback of forcing my domain objects to implement INotifyPropertyChanged ?

I am thinking of making all my entities in my domain model implement INotifyPropertyChanged . My main reason behind this would be: If some entity gets changed in the domain the presentation layer would immediately know about it and change accordingly (I am trying to implement the MVPVM pattern and the presentation objects are not the sa...

Can Aggregate root entity calls Repository

Hi all, my question is Can Aggregate root entity have method in which it will call a Repository ? I know it should not but want to get confirmed as Eric's book is also not saying anything clearly :( one more thing where can i get unit testing example for domain driven design ? ...

DDD: Should everything fit into either Entity or Value Object?

Hi, I'm trying to follow DDD, or a least my limited understanding of it. I'm having trouble fitting a few things into the DDD boxes though. An example: I have a User Entity. This user Entity has a reference to a UserPreferencesInfo object - this is just a class which contains a bunch of properties regarding user preferences. These ...

Would like some modelling tips for dependent values

I'm working on a model for a simple fishing competition and I have some issues with my design. The main class for the fishing game is Capture and it looks like this: public class Capture : Entity { public virtual int Weight { get; set; } public virtual int Length { get; set; } public virtual DateTime DateForCapture { get; ...

Career Killer? Nhibernate, OOP, Design Patterns, Domain Driven Design, Test Driven Development, IoC, MVC

I have a fairly slick approach to doing C# development using the above tools/methodologies. Specifically i follow the "Jeffrey Palermo Agile Bootcamp" onion architecture. I feel like I'm a strong developer/architect using these tools and that these make me more productive and help make more maintainable code. I think these are all imp...

DDD - Aggregate Roots and Creating Behavioural Objects

I want to ask for some advise on how to avoid writing objects which are mere data containers. Consider the following Aggregate Root: public class Post : IAggregateRoot { List<Comment> Comments {get; set;} } Given the pinciples that govern how aggregate roots work, is it valid to call the above code like this? new Post().Comments.A...

Question about creating component from root in DDD.

Hi, I am new to the DDD. I have a question about how to solve the following scenario using DDD. I have 2 entities 'Person' and 'Email' with one to many relationship. A person can have zero or more email address(es). 'Person' is an aggregate root of 'Email' which is a component. class Person{ Set emails = new HashSet } Class Emai...

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

Free video (screencast , webcasts ...) training on DDD

Are there any free video training resources for Domain Driven Design ? ...

How do I filter an entity based on another entity? Linq many-to-many in C#.

This is easy to do in SQL and I'm having a very hard time achieving this using Linq to SQL. I have two entities setup, Project and ProjectsbyUser: [Table(Name = "Projects")] public class Project { [Column(IsPrimaryKey = true, IsDbGenerated = true, Name="Job")] public string ProjectId { get; set; } [Column(Name = "Descript...