2011-04-20 63 views
0

需要關於轉換我的VB.NET DTO的幫助,以便WCF RIA可以將它們用於LightSwitch應用程序。在VB.NET中使用WCF RIA中的自定義DTO

我發現這裏一個很好的例子:http://blogs.msdn.com/b/brada/archive/2009/07/16/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-part-6-data-transfer-objects-dtos.aspx

我的問題,我沒能找到一個答案是怎麼做的我代表標註在方括號在VB.NET,C#代碼的語法?

public class SuperEmployeeDTO{ 

public SuperEmployeeDTO()   
{   
} 

[ReadOnly(true)]   
[Key]   
public int EmployeeID {get;set;} 

感謝提前:)

回答

1
<[ReadOnly](True)> 
<Key()> 
Public Property EmployeeID() As Integer 
    Get 
     Return m_EmployeeID 
    End Get 
    Set(ByVal value As Integer) 
     m_EmployeeID = value 
    End Set 
End Property 
Private m_EmployeeID As Integer 
+0

'進口System.ComponentModel' 讓 '<[只讀](真)> _' 是,但它仍然是不喜歡 ' _' 上方我的關鍵屬性。我應該爲此導入任何內容?謝謝@Robbie攻 – 2011-04-20 11:51:07

+0

也許試試<[Key]()> _ – 2011-04-20 11:52:14

+0

這是我嘗試過的。 「類型鍵未定義」是我的錯誤。 – 2011-04-20 11:52:51