Service Context. Add Object(String, Object) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds the specified object to the set of objects that the DataServiceContext is tracking.
public: void AddObject(System::String ^ entitySetName, System::Object ^ entity);
public void AddObject (string entitySetName, object entity);
member this.AddObject : string * obj -> unit
Public Sub AddObject (entitySetName As String, entity As Object)
The name of the entity set to which the resource will be added.
The object to be tracked by the DataServiceContext.
entity is null.
entitySetName is empty.
entity does not have a key property defined.
The entity is already being tracked by the context.
The object is put into the tracking set of the DataServiceContext in the Added state. The DataServiceContext will try to insert the object by HTTP POST on the next call to SaveChanges. This method does not add objects related to the specified entity to the DataServiceContext. Each object must be added through a separate call to AddObject.
The method does not validate that the entity set specified is in the data service associated with the DataServiceContext or that the added object has the required properties needed to be added to the specified