我真的無法弄清楚爲什麼在WPF客戶端下RIA服務我看不到更新,插入和刪除的方法。但我只能看到所有「GET」方法。RIA服務的插入,更新和刪除方法在WPF客戶端對RIA服務不可見
RiaService.DomainServicesoapClient proxy = new RiaService.DomainServicesoapClient(EndPointConfigurationNameData, EndpointAddress);
proxy.GetClients(); // That's OK
// But where is ????
proxy.UpdateClient(...
下面的代碼已經由Visual Studio生成2010
[RequiresAuthentication]
[EnableClientAccess()]
public class RiaDomainService : LinqToEntitiesDomainService<MyEntities>
{
.....
// TODO:
// Consider constraining the results of your query method. If you need additional input you can
// add parameters to this method or create additional query methods with different names.
// To support paging you will need to add ordering to the 'Clients' query.
[Query(IsDefault = true)]
public IQueryable<Client> GetClients()
{
return this.ObjectContext.Clients;
}
public void InsertClient(Client client)
{
if ((client.EntityState != EntityState.Detached))
{
this.ObjectContext.ObjectStateManager.ChangeObjectState(client, EntityState.Added);
}
else
{
this.ObjectContext.Clients.AddObject(client);
}
}
public void UpdateClient(Client currentClient)
{
this.ObjectContext.Clients.AttachAsModified(currentClient, this.ChangeSet.GetOriginal(currentClient));
}
public void DeleteClient(Client client)
{
if ((client.EntityState != EntityState.Detached))
{
this.ObjectContext.ObjectStateManager.ChangeObjectState(client, EntityState.Deleted);
}
else
{
this.ObjectContext.Clients.Attach(client);
this.ObjectContext.Clients.DeleteObject(client);
}
}
所以CRUD方法沒有得到由RIA方面的認可...... 任何線索如何得到它的客戶端
下更新:
我發現這段代碼就像一個CRUD
RiaService.ChangeSetEntry changeSetEntry = new RiaService.ChangeSetEntry();
changeSetEntry.Entity = {entity itslef};
changeSetEntry.Operation = RiaService.DomainOperation.Insert;
changeSetEntries.Add(changeSetEntry);
proxy.SubmitChanges(changeSetEntries.ToArray());
我的問題是:有沒有其他方法來實現在WPF客戶端到RIA服務的CRUD操作?
謝謝! 「...那簽名」無效UpdateClient()「」當我嘗試輸入像更新或插入甚至刪除我什麼也看不到任何方法。 AND whT我可以看到所有返回數據的方法... –