简体   繁体   English

向WCF服务添加引用的最佳实践

[英]Best Practice For Adding Reference to WCF Service

I have a class with a bunch of static const members in an external project (I use it basically like an enum) and one of my WCF services wants to use that class. 我在外部项目中有一个带有一堆静态const成员的类(我基本上像枚举一样使用它),而我的WCF服务之一想使用该类。

Is it better just to recreate the class within the service project or should I add an assembly reference in my WCF service project to the external project? 仅在服务项目中重新创建类是更好的方法,还是应该在WCF服务项目中向外部项目添加程序集引用? It is kind of weird because the external project in this case is a ASP .NET MVC application. 有点奇怪,因为在这种情况下,外部项目是ASP .NET MVC应用程序。 If I recreate the class, my service will be basically self-sufficient, but I would be repeating myself. 如果我重新创建该类,则我的服务基本上将是自给自足的,但是我会重复自己。

What is the best thing to do in this situation? 在这种情况下最好的办法是什么?

将您的静态const成员放在自己的程序集中,并让WCF服务和ASP.NET MVC应用程序共享它。

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

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