1
我有一個WCF數據服務正在運行,它正在公開EDM。我需要在客戶端有幾個屬性,數據庫不需要知道。設置完所有後,我需要測試SaveContext方法,並在服務器上獲取此錯誤「處理請求流錯誤。爲'DataModels.Customer'類型指定的屬性名'CanDelete'無效。WCF數據服務客戶端上的部分類屬性導致SaveContext異常
有沒有辦法告訴WCF數據服務在客戶端忽略此屬性?或者我應該轉向RIA Serivces?我讀過將屬性設置爲internal會執行此操作,但我需要該屬性進行綁定,並且在不同的項目中有客戶端UI代碼(將我的SL應用程序從我的數據服務中解除耦合)。
在客戶端上我:
public partial class Customer
{
private bool canDelete;
/// <summary>
/// Gets or sets a value indicating whether this instance can be deleted.
/// </summary>
/// <value>
/// <c>true</c> if this instance can delete; otherwise, <c>false</c>.
private bool canDelete;
/// <summary>
/// Gets or sets a value indicating whether this instance can be deleted.
/// </summary>
/// <value>
/// <c>true</c> if this instance can delete; otherwise, <c>false</c>.
/// </value>
public bool CanDelete
{
get
{
return this.canDelete;
}
set
{
if (this.canDelete != value)
{
this.canDelete = value;
this.OnPropertyChanged("CanDelete");
}
}
}
}