一些设计问题到开发基于WCF的系统

时间:2014-06-02 10:07:53

标签: c# wcf

请遵循以下给出的解决方案结构。

enter image description here

这里我在一个解决方案下有三个主要项目: ServiceClient(它是一个控制台应用程序。使用SQLMonitorServer WCF服务)

SQLMonitorEngine(这是写入C#的核心引擎,它帮助我返回已配置的sql实例的性能数据。)

SQLMonitorServe(这是一个wcf服务,它使用SQLMonitorEngine并从Engine中检索数据并根据请求将该数据传递给ServiceClient。)

SQLMonitorEngine低于给定的类 enter image description here

但是在这里我不能将这个类暴露给我的ServerClient。所以我将这个类再次写入SQLMonitorServer,如下所示,

enter image description here

请参阅SQLMonitorServe中的接口和公开的服务方法,如下所示,

enter image description here

进入ServerClient我已经访问过此服务,

enter image description here

现在的问题是:

  1. 为什么这里的属性名称是_BackingField。我不能将它用作普通名称,例如直接使用AuthType。

  2. 由于ServerInfo的重复类进入SQLMonitorServer和SQLMonitorEngine,我的解决方案不会调试并给我以下错误,

  3. Error   3   Argument 1: cannot convert from 'SQLMonitorServer.ServerInfo' to 'SQLMonitorEngine.ServerInfo'  D:\Dev\SQLMonitor\SQLMonitorEngine\SQLMonitorServer\SQLMonitorService.svc.cs    17  46  SQLMonitorServer
    Error   2   The best overloaded method match for 'SQLMonitorEngine.QueryAPI.GetServerVersion(SQLMonitorEngine.ServerInfo)' has some invalid arguments   D:\Dev\SQLMonitor\SQLMonitorEngine\SQLMonitorServer\SQLMonitorService.svc.cs    17  20  SQLMonitorServer
    

1 个答案:

答案 0 :(得分:0)

您的ServerInfo课程需要具有自动属性,而不是字段。由于它有字段,因此您可以使用wcf客户端向导创建字段。

您的两个ServerInfo类的类型不同,因此您需要创建一个类型的新类,并使用旧类型填充属性。