NStuke NStuke - 1 year ago 129
C# Question

Using AttachTo with a Contained EntitySet

I have some classes defined as below:

public class Table

public string Name { get; set; }

public IList<TableEntity> Entities { get; set; }

public class TableEntity
public string Partition { get; set; }

I want to use AttachTo to add an object to the DataServiceContext without querying for it first. How can I do this?

Answer Source

I was able to do this by doing

context.AttachTo("Tables(\'TableName\')/Entities", tableEntityInstance);

Not very elegant, but it works.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download