domain-driven-design

Is the Controller in MVC considered an application service for DDD?

末鹿安然 提交于 2019-12-29 04:34:28
问题 I am applying DDD for the M part of my MVC and after some research (studying up!), I have come to the realization that I need my controller to be interacting with domain services (in the model). This would make my controller the consumer of the domain services and therefore an application service (in DDD terms). Is this accurate? Is there a difference between a controller and what DD defines as an application service? 回答1: The controller is not considered a service in DDD. The controllers

Why does the entity framework need an ICollection for lazy loading?

纵然是瞬间 提交于 2019-12-28 02:51:50
问题 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 RemovePhoto(){...} } But the entity framework (V4 code first approach) requires an ICollection type for lazy loading! The above code no longer works as designed since clients can bypass the AddPhoto / RemovePhoto method and directly call the add method on ICollection. This is not good. public class Product { public ICollection<Photo>

Polymorphism: Is ORM entity a Domain Entity or Data Entity?

ぐ巨炮叔叔 提交于 2019-12-28 02:16:04
问题 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 BankAccount : INotifyPropertyChanging, INotifyPropertyChanged Now, being a newbie, I am newly creating the domain objects myself. Please see IBankAccount interface and FixedBankAccount class. The key point is there is polymorphic behavior – the IBankAccount can be FixedBankAccount or SavingsBankAccount. For

How to pass Current User Information to all Layers in DDD

限于喜欢 提交于 2019-12-28 01:55:15
问题 Similar questions have been asked before but not quite the same (unless I missed it) I want to pass IUserInfo class instance through my Service, Domain , Domain Events, Domain Event Handlers... Whats is the best way to do it. Should I Inject it using IoC by registering it against instance of Httpcontext.Current.session["CurrentUser"]; Add the data to Current Thread. Any other way I am stuck at Domain Event Handlers where I want to use the data for auditing as well as sending emails. I want to

How to remove unit of work functionality from repositories using IOC

只愿长相守 提交于 2019-12-27 14:01:47
问题 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 HttpContext . There is a controller factory which gets the controller instances using the unity container. I set-up all my dependencies on the constructors, like this: // Initialize a new instance of the EmployeeController class public EmployeeController(IEmployeeService service) // Initializes a

How to remove unit of work functionality from repositories using IOC

天涯浪子 提交于 2019-12-27 13:58:54
问题 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 HttpContext . There is a controller factory which gets the controller instances using the unity container. I set-up all my dependencies on the constructors, like this: // Initialize a new instance of the EmployeeController class public EmployeeController(IEmployeeService service) // Initializes a

which architecture is good for implementing in this project? [closed]

﹥>﹥吖頭↗ 提交于 2019-12-27 02:09:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . i am new in architecture .I have a MVC web application project and I want to use EF code FIRST .I want to use an architecture for this project.I want to use DDD(domain driven design) but it is for large project. i want a simple of DDD that support this things in my project: 1-repository pattern 2-IOC 3-service

Application Services Composition

让人想犯罪 __ 提交于 2019-12-25 18:45:14
问题 I've a Customer entity that has an referente to City: public class Customer { public int CustomerId { get; set; } public int CityId { get; set;} } Then, the following application service: public class CustomerService { private readonly ICustomerRepository customerRepository; public CustomerService(ICustomerRepository customerRepository) { this.customerRepository = customerRepository; } public void RegisterCustomer(Customer customer) { //Do another things... customerRepository.Save(customer);

ef context + database schema + DDD BoundedContext

拥有回忆 提交于 2019-12-25 12:21:58
问题 I understand that at least EF 6 supports multiple DbContexts. This can be used to model BoundedContext. I did some google searches but could not find a definitive answer to this question. Is it advisable to use different db schemas for different DbContexts/BoundedContext? I know that ORMs abstract away the persistence mechanisms but I personally can see parallels between shemas and ddd/ef contexts. 回答1: It is a possibility. As with most architectural questions, the answer is: it depends. In

Identifying Bounded Context

十年热恋 提交于 2019-12-25 09:12:41
问题 everytime i think i understand how to recognize bounded context's i realize the waters are still murky. so here goes... i am developing a customer portal that contains the following features: Customers, Users, Announcements, Feedback, Documents, and Reimbursements. We are just putting a pretty UI over reimbursement approvals from another system, so this one is easy to see it's another BC we integrate with. Now with the others, I'm not sure how to group these together. Would all these belong