I'm starting large project and I want use DDD. The main problem is how to display data from multiple Bounded Context without duplicating data and mappings of NH. I watched Udi's podcast about composite application. He mention about using Razor sections to display data from multiple bounded contexts but he doesn't provide any details. Does anybody know how to use it or does anybody know other way?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
- Install ASP.NET 5.0 version of System.ServiceModel
相关文章
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
- Can Persistence Ignorance Scale?
Good thing about Razor is that it allows you to have completely independent controllers that are responsible for rendering parts of the single page (portal style). For example in your main Razor view:
Where
NewProductsController
andProductRatingsController
belong to different Bounded Contexts and look like this:Note that controllers don't know about each other although they will display data on the same page. The repositories can be injected using DI container in the Composition Root of your application.
In regards to NH mappings, each bounded context (BC) should have its own set of mappings and therefore its own session factory. It can be tricky to configure a DI container such that it resolves the appropriate session factory for each respective BC, because the session factory interface will have to be "tagged" to be associated with a particular BC and then all dependencies within that BC will also have to be associated with that tag. Another option is to create a open host service (such as REST) to encapsulate each BC and then reference the service from your web app. This way you don't have to worry about managing NH mappings in your web application.