简体   繁体   English

基于插件的WCF Web服务

[英]Plugin based WCF Webservice

I am implementing a IIS Hosted WCF web service to accept leads from third parties. 我正在实施IIS托管WCF Web服务,以接受来自第三方的线索。 There are plenty of operations that may happen pre/post saving the information. 保存信息前后,可能会发生很多操作。 I am thinking of implementing this as plug-in based architecture. 我正在考虑将其实现为基于插件的体系结构。

Example of pre-save operations are 预保存操作的示例是

  • duplicate checking before saving 保存前重复检查
  • making sure the information is valid (not mickey mouse) 确保信息有效(不是米老鼠)

Post-save operations are 保存后的操作是

  • zipcode based routing to correct warehouse 基于邮政编码的路由以更正仓库
  • lead assignment. 潜在客户分配。

I have been reading about MEF, but i have been unable to decide if this is actually worth implementing MEF where loading and unloading of plugins for every call will likely increase the overhead? 我一直在阅读有关MEF的信息,但我无法确定这是否值得实施MEF,在这里每次调用的插件加载和卸载都可能增加开销? Is there a way to just load all your plugins in some magic application_start ? 有没有一种方法可以将所有插件仅加载到一些神奇的application_start

I agree with Steven that you don't need a plugin architecture for this. 我同意史蒂文的观点,您不需要插件架构。 You are good to go with just properly designed services. 您可以选择设计适当的服务。 There are some very good hints about this in Steven's blog post - Writing Highly Maintainable WCF Services . 在Steven的博客文章“ 编写高度可维护的WCF服务”中对此有一些很好的提示。

Nonetheless, to answer the second part of the question, there is nothing stopping you from initializing the MEF composition container in your Application_Start and store it statically (other than that it introduces a global state, which is often a bad design decision). 尽管如此,要回答问题的第二部分,没有什么可以阻止您在Application_Start初始化MEF合成容器并将其静态存储(除了它引入了全局状态,这通常是一个糟糕的设计决定)。 Then it would be shared across the requests and you could use it to compose parts as needed without the overhead of repeated exports discovery. 然后,它将在请求之间共享,您可以根据需要使用它来组成零件,而无需重复导出发现的开销。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM