RelatedEnd.ValidateOwnerForAttach 方法


確保相關端所屬的物件支援附加作業。Ensures that the object to which the related end belongs supports an attach operation.

protected public:
 void ValidateOwnerForAttach();
protected internal void ValidateOwnerForAttach ();
member this.ValidateOwnerForAttach : unit -> unit
Protected Friend Sub ValidateOwnerForAttach ()


當來源物件沒有附加至 ObjectContext、從 NoTracking 查詢中傳回來源物件,或者來源物件並非處於 ModifiedUnchanged 狀態。When the source object is not attached to the ObjectContext, was returned from a NoTracking query, or is not in a Modified or Unchanged state.


物件服務會在執行附加作業之前呼叫 ValidateOwnerForAttach 方法,以確保作業將會成功。Object Services calls the ValidateOwnerForAttach method before executing an attach operation to ensure that the operation will succeed.