.net 将web服务响应映射到业务对象属性
我在业务层有以下类.net 将web服务响应映射到业务对象属性,.net,.net,我在业务层有以下类 Class Person { private string firstName; Public string FirstName { get{ return firstName; } set{ firstName = value; } } privat
Class Person {
private string firstName;
Public string FirstName
{
get{
return firstName;
}
set{
firstName = value;
}
}
private string lastName;
Public string LastName
{
get{
return lastName;
}
set{
lastName = value;
}
}
}
下面的web服务为我获取需要在Person对象中设置的数据
public partial class MyWebservice
{
private string strFstName;
private string strLstName;
/// <remarks/>
public string FName {
get {
return this.strFstName;
}
set {
this.strFstName = value;
}
}
/// <remarks/>
public string LName {
get {
return this.strLstName;
}
set {
this.strLstName = value;
}
}
}
公共部分类MyWebservice
{
私有字符串strFstName;
私有字符串strLstName;
///
公共字符串FName{
得到{
返回this.strFstName;
}
设置{
this.strFstName=值;
}
}
///
公共字符串名称{
得到{
返回此.strLstName;
}
设置{
this.strLstName=值;
}
}
}
我需要将响应从web服务映射到业务对象。我有一个业务层类,它有100多个属性,需要从web服务响应中填充这些属性。我只知道一种方法。迭代web服务响应并设置业务对象属性。是否有更简单的方法将web服务属性映射到业务对象属性?我正在寻找一种代码行数更少的更简单的方法。听起来像是