2012-05-31 160 views
1

我在业务层中有以下类。映射对业务对象属性的Web服务响应

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; 
     } 
    } 
} 

我需要将响应从web服务映射到业务对象。以上只是一个示例。我有一个具有100多个属性的业务层类,需要从Web服务响应中填充。我只知道一种方法。即。迭代通过Web服务响应并设置业务对象属性。有没有更简单的方法将Web服务属性映射到业务对象属性?我正在寻找一种更少的代码行的更简单的方法。

回答

相关问题