728 questions
84
votes
6
answers
36k
views
EF codefirst : Should I initialize navigation properties?
I had seen some books(e.g programming entity framework code first Julia Lerman) define their domain classes (POCO) with no initialization of the navigation properties like:
public class User
{
...
7
votes
4
answers
1k
views
Making Entity Class Closed for Changes
I have a database relationship as shown below. The domain objects are created based on LINQ to SQL ORM.
A payment comprises of Cash Payment and Gift Coupon Payments. Suppose the total amount of ...
19
votes
2
answers
4k
views
Who should handle the conditions in complex queries, the data mapper or the service layer?
this question did a very good job of clearing my confusion a bit on the matter, but I'm having a hard time finding reliable sources on what the exact limitations of the service layer should be.
For ...
310
votes
9
answers
118k
views
Should services always return DTOs, or can they also return domain models? [closed]
I'm (re)designing large-scale application, we use multi-layer architecture based on DDD.
We have MVC with data layer (implementation of repositories), domain layer (definition of domain model and ...
2
votes
2
answers
800
views
Persist Data by Programming Against Interface
I have a IBankAccount interface that I will be passing to the ApplicationService. The changes made on the account objects (in the ApplicationService project) need to be persisted in the database. The ...
140
votes
9
answers
60k
views
Value vs Entity objects (Domain Driven Design)
I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performance.. etc) a system could ...
11
votes
2
answers
6k
views
How to remove unit of work functionality from repositories using IOC
I have an application using ASP.NET MVC, Unity, and Linq to SQL.
The unity container registers the type AcmeDataContext which inherits from System.Data.Linq.DataContext, with a LifetimeManager using ...
79
votes
2
answers
22k
views
How are Value Objects stored in the database?
I haven't really seen any examples, but I assume that they are saved inside the containing entity table within the database.
Ie. If I have a Person entity/aggregate root and a corresponding Person ...
36
votes
5
answers
22k
views
MVVM: Binding to Model while keeping Model in sync with a server version
I've spent quite some time to try and find an elegant solution for the following challenge. I've been unable to find a solution that's more than a hack around the problem.
I've got a simple setup of ...
12
votes
2
answers
6k
views
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 ...
41
votes
6
answers
26k
views
Communicating between two Bounded Contexts in DDD
I have few different Bounded Contexts in the domain. The validation of a CRUD operation is built in each Bounded Context.
For example, I can create an entity called GAME only if the person creating ...
4
votes
1
answer
1k
views
IQueryable & Repositories - take 2?
I have to admit I have been carrying the "Repository should not return IQueryable" banner because it is harder to test. I have been influenced by the answers to other questions like this and this.
...
1
vote
1
answer
792
views
Polymorphism: Is ORM entity a Domain Entity or Data Entity?
I have a BankAccount table. LINQ to SQL generates a class named “BankAccount” as shown below.
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.BankAccount")]
public partial class ...
37
votes
4
answers
5k
views
How to handle set based consistency validation in CQRS?
I have a fairly simple domain model involving a list of Facility aggregate roots. Given that I'm using CQRS and an event-bus to handle events raised from the domain, how could you handle validation ...
28
votes
3
answers
15k
views
Why does the entity framework need an ICollection for lazy loading?
I want to write a rich domain class such as
public class Product
{
public IEnumerable<Photo> Photos {get; private set;}
public void AddPhoto(){...}
public void ...
94
votes
5
answers
82k
views
DDD - which layer DTO should be implemented
I am learning about DDD so apologies if my question is naive. I think I need to use Local Data Transfer Object in order to display data to the users as a lot of properties are not part of any of ...
43
votes
2
answers
40k
views
DDD, Anti Corruption layer, how-to?
At the moment, we have to build an application which is based on a legacy one. Code for that old application should be thrown away and rewritten, but as it usually goes - instead of rewriting it, we ...
136
votes
8
answers
66k
views
DTO = ViewModel?
I'm using NHibernate to persist my domain objects.
To keep things simple I'm using an ASP.NET MVC project as both my presentation layer, and my service layer.
I want to return my domain objects in ...
74
votes
5
answers
47k
views
Rest API and DDD
In my project using DDD methodology.
The project has the aggregate(entity) Deal. This aggregate has many of use cases.
For this aggregate I need to create a rest api.
With standard: create and ...
54
votes
6
answers
52k
views
Repository pattern and mapping between domain models and Entity Framework
My repositories deal with and provide persistence for a rich domain model. I do not want to expose the anemic, Entity Framework data entity to my business layers, so I need some way of mapping ...
32
votes
3
answers
20k
views
DDD Using Specification pattern for Validation
I am thinking of using Specification pattern for validation purposes. The hard thing is how to tell the user why some Specification was not satisfied. What if the Specification.IsSatisfiedBy() will ...
13
votes
3
answers
11k
views
Program Design - Package by Feature vs. Layer or Both?
I am in the design stage of a web application that allows users to create requests of work and the workers to put time against those requests. The application will also have reporting capabilities for ...
2
votes
3
answers
5k
views
Unit Testing without Database: Linq to SQL
I have a repository implemented using LINQ to SQL. I need to do Unit Testing though I don't have a database. How can I write the UT for FreezeAllAccountsForUser method? Can you please show an example ...
91
votes
2
answers
26k
views
Access Control in Domain Driven Design
I read about DDD and Access Control, and I found some contradiction between the following two opinions:
"security concerns should be handled outside the domain"
"access control ...
50
votes
7
answers
8k
views
What is domain driven design? [closed]
So I got this question from one of the developers in my team: What is domain driven design? I could of course point to the book from Evans but is that actually an answer?
How would you explain DDD ...