DataServiceContext.WritingEntity 事件


在实体已完全序列化为请求消息中的 XML 之后发生。Occurs after an entity has been fully serialized into XML in a request message.

 event EventHandler<System::Data::Services::Client::ReadingWritingEntityEventArgs ^> ^ WritingEntity;
public event EventHandler<System.Data.Services.Client.ReadingWritingEntityEventArgs> WritingEntity;
member this.WritingEntity : EventHandler<System.Data.Services.Client.ReadingWritingEntityEventArgs> 
Public Event WritingEntity As EventHandler(Of ReadingWritingEntityEventArgs) 


处理 WritingEntity 事件可以让您在发送请求之前更改请求中的 XML。Handling the WritingEntity event enables you to change the XML in a request before it is sent.

如果在调用 WritingEntity 时未在提供的 BeginSaveChanges(SaveChangesOptions, AsyncCallback, Object) 值中包括 Batch,则可能会在其他线程中发生 SaveChangesOptions 事件。The WritingEntity event may occur on a different thread when you call BeginSaveChanges(SaveChangesOptions, AsyncCallback, Object) without including Batch in the supplied SaveChangesOptions value.