0

使用AttachTo我定義如下幾類:與被包含的EntitySet的

public class Table 
{ 

    [Key] 
    public string Name { get; set; } 

    [Contained] 
    public IList<TableEntity> Entities { get; set; } 
} 

public class TableEntity 
{ 
    [Key] 
    public string Partition { get; set; } 
} 

我想用AttachTo添加一個對象到DataServiceContext不先查詢它。我怎樣才能做到這一點?

回答

0

我能夠做

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

不是很優雅做到這一點,但它的作品。