domain-driven-design

How to convert old data to a new system? using sql or managed code?

Let say a company are building a brand new application. The application are following the DDD principles. The old codebase has alot of products (or another "entity" for the company) that they want to convert to the new codebase. How should this work be done? normally it is faster and easier to import using for examples ssis,-transferrin...

Repository Pattern: What is the 'right size'?

I'm building some repositories for an MVC application, and I'm trying to come up with the right way to divide responsibilities between repositories. In most cases, this is obvious. But there is one particular case where I'm not sure what the right answer is. The users of this application need to track multiple types of time for their em...

DDD: How shuld I divde application to Bounded Contexts besides e-commerce sample?

Hello. We have a pretty big application here and I considering to refactor it a little bit to follow DDD guys guidance. For now the number one issue with it is Bounded Contexts and Context Maps. Maybe I just don't grok it, but it seems to me just impossible to do division. For example we have User object all over the place and it's exa...

In domain-driven design, would it be a violation of DDD to put calls to other objects' repostiories in a domain object?

I'm currently refactoring some code on a project that is wrapping up, and I ended up putting a lot of business logic into service classes rather than in the domain objects. At this point most of the domain objects are data containers only. I had decided to write most of the business logic in service objects, and refactor everything aft...

In DDD, what are the actual advantages of value objects?

I have gotten so far that I understand entity objects have an ID while value object have not, but in the most common example you have the person entity that have a address value object attached to it. What is the big advantage of creating a separate address object instead of just keeping the address properties within the Person Entity? ...

Business entities / value objects framework with DbC support

The thing I think I spend most time on when building my business models is the validation of business entities and making sure the entity objects and their relationships maintains good integrity. My dream for a good entity/value object framework would help me create reusable entities/value objects and easily create constraints and rules ...

Is it bad practice to run tests on a DB instead of on fake repositories?

I know what the advantages are and i use fake data when i am working with more complex systems. What if I am developing something simple and I can easily set up my environment in a real DB and the data being accessed is so small that the access time is not a factor and I am only running a few tests. Is it still important to create fak...

Techniques for dealing with anemic domain model

I've read some of the questions regarding anemic domain models and separation of concerns. What are the best techniques for performing/attaching domain logic on anemic domain objects? At my job, we have a pretty anemic model, and we're currently using "helper" classes to perform the database/business logic on the domain objects. For e...

What methods should go in my DDD factory class?

I am struggling to understand what my factory class should do in my DDD project. Yes a factory should be used for creating objects, but what exactly should it be doing. Consider the following Factory Class: public class ProductFactory { private static IProductRepository _repository; public static Product Creat...

Repository, Entity objects and Domain Objects

In my Repositories, I am making assignments to my domain objects from the Linq Entity queries. I then have a service layer to act on these object returned from repositories. Should my Domain objects be in the repository like this? Or should my repositories be restricted to the Entities and Data Access, and instead have my service layer...

Alternative Data Access pattern to Repository

I have certain objects in my domain which are not aggregate roots/entities, yet I still need to retrieve them from a database. I don't want to confuse things by creating repositories for these things. So, what are alternative data access patterns? Would you simply create a DAO for them, while still of course separating the interface? E...

Is it ok to set Datacontext as a property in repository?

Is there any potential problem in setting datacontext as property like this: repository public Repository() { public DataContext dc {get;set;} public GetOrders(int id) { ...from dc.Orders...} } service layer: public GetNewOrders() { .... Repository rep=new Repository(); using {DataContext dc=...

How do YOU factor your Domain (namespaces), in Domain Driven Design?

How do YOU factor your Domain (namespaces), in Domain Driven Design? I have been moving to the following concept: Project.Entity Project.Entity.Abstracts Project.Entity.Entities Project.Entity.Extensions Project.Entity.Immutables Project.Entity.Interfaces Project.Entity.Repositories For example, I have an entity in a CMS ...

Advice on domain modeling

Hi All New to DDD here and have a architecture question which should be a typical problem. I have a StockItem entity and a Store entity. I assign a StockItem to multiple Stores and set different ParLevels for each store. I then need to have transactions (sale, purchase, transfer-in etc) that adjust the quantity on hand at the various s...

MVC pattern + DDD pattern

In an MVC application, how is DDD implemented. What are the domain objects? If I map entities to custom objects, where does this mapping logic go, in the methods of the repositories or in the service layer? ...

Asynchronously loading a domain model

I have started a small project to properly teach myself about a number of things: domain driven development and inversion of control are the ones that apply in this case. I have decided to write an application that can load and visualize timing data from sports events (I have access to quite a lot of this type of data). One requireme...

DDD User Security Policies

I have a RentalProperty class which looks something like this: class RentalProperty { Money MonthlyRent; List<MaintainenceCall> MaintainenceCalls; } From my understanding, using DDD to change the MonthlyRent, I would get the RentalProperty, change the MonthlyRent property, and call RentalPropertyRepository.Save(). The same pr...

Database Schema from DomainModel

Hi guys, Does anyone have experience with generating database schema from c# (.net 3.5) domain model? Which of the tools produces the cleanest script? Telerik OpenAccess ORM would have been ok but it doesn't produce clean column names from c# classes if the property fields use .net 3.5 implicit private fields. I just need an initial sc...

What is the best practice for readonly lists in NHibernate

Hello, Domain Model I am working on has root aggregate and child entities. Something like the following code: class Order { IList<OrderLine> Lines {get;set;} } class OrderLine { } Now I want my Order to control lines. Something like that: class Order { OrderLine[] Lines {get;} void AddLine(OrderLine line); } At this tim...

Abstract Base class for All Domain Entity Objects

I am seeing in some domain object models that an abstract base class is created(that implement Equals and GetHashCode) for all domain Entity objects to inherit from to gain their identity. I am not clear why this base class is needed and when and why it should be used. Can you provide me some insight on this or refer me a link that talk...