项目结构使用WCF架构一是服务发展 [英] Project structure for Schema First Service Development using WCF

查看:205
本文介绍了项目结构使用WCF架构一是服务发展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有WSDL和XSD为出发点。 (WSDL是从XSD使用WCSF蓝色工具生成)。从WSDL,使用工具,该服务code为生成。该项目名称为Autogenerated_Service_Project。在这个项目中,将有[的ServiceContract]和[DataContract]班。它有一个名为EmployeeDataContract数据合同。在getEmployee的()服务操作,这datacontract被返回给客户端。

I have WSDL and XSD as starting point. (WSDL is generated from XSD using WCSF Blue tool). From the WSDL, using a tool, the service code is generated. The project name is "Autogenerated_Service_Project". Inside this project it will have [ServiceContract] and [DataContract] classes. It has a data contract named "EmployeeDataContract". In the GetEmployee() service operation, this datacontract is returned to the client.

我有一个名为Business_Project业务层项目。它有一个返回雇员实体对象的方法。

I have a business layer project named "Business_Project". It has a method that returns "Employee" entity object.

在present,我所指的Business_Project内部Autogenerated_Service_Project。

At present, I am referring the "Business_Project" inside "Autogenerated_Service_Project".

Business_Project.MyClass b = new Business_Project.MyClass();
EmployeeDataContract d = b.GetAssociate();
return EmployeeDataContract;

挑战在于,当出现发生在WSDL的变化。当WSDL是改变了Autogenerated_Service_Project将被重新创建和code上面提到将会丢失。

The challenge comes when there happens a change in WSDl. When the WSDL is the changed the "Autogenerated_Service_Project" will be recreated and the code mentioned above will be lost.

有什么解决办法来克服这个code损失?

What is the solution to overcome this code lose?

注:Autogenerated_Service_Project是最上面的项目。理想的情况下,它不能被任何其他项目称为

Note: The "Autogenerated_Service_Project" is the top most project. Ideally, it cannot be referred by any other projects.

推荐答案

这可以通过使用的分部类的在不同的文件中。在这个问题中给出的code可以被移动到这个新的部分的类文件。该文件将持久存在,即使是重新创建自动生成的文件。

This can be resolved by using Partial Classes in a different file. The code given in the question can be moved to this new partial class file. This file will persist even if the auto generated file is re-created.

这篇关于项目结构使用WCF架构一是服务发展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆