DI CompositionRoot with multi service WCF Host

故事扮演 提交于 2019-12-08 17:29:45

Having a composition root per service is fine, but if you can, let your WCF service just contain 1 service with 2 methods: One method that allows you to execute query objects, one method that allows you to execute commands. This way you will still have one Composition Root for your WCF service.

To allow to do this you need to model all mutations as commands/handlers and read operations as query/handlers. When you've done this, you will never have to change anything to the SVC ever again.

Take a look at the Silverlight Cookbook, which successfully uses this approach. Take a look at the Main\Cookbook\Services.Host\CommandService.svc.cs, which is the entry point of the WCF service.

This will probably turn your world completely upside down, but this architecture is very flexible, scalable, and can lower the maintenance costs dramatically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!