One of the most important concepts when applying either SOA or DDD is the definition of Services (or Bounded Contexts in the DDD lingo).
Each of these services will be responsible for its own data and behavior and could also own the UI components of that service.
Let’s see an example with the typical Ecommerce domain:
In this case we have two services, Sales & Shipping, and each of them owns its UI components that will be rendered by the UI host. That’s the result:
In this example, I’m using Razor Generator in order to let services to have their own MVC components in class libraries, which will be referenced by the central UI host:
The use of Razor Generator is very straightforward:
- Install RazorGenerator from VS gallery
- On each class library, install RazorGenerator.Mvc from Nuget
- Create the folder structure following MVC conventions (Controllers, Views, etc.)
- Add a web.config to get intellisense for your views
- Change “Custom Tool” to RazorGenerator on your views in order to precompile it
Then, decorate your actions as ChildActionOnly to behave like a widget:
Take a look at the sample on github and let me know!!