IMobileServiceTable无法发布

时间:2018-05-30 22:51:57

标签: c# asp.net-mvc azure xamarin azure-sql-database

我试图在Azure表中插入一行,我收到错误:

  

无法发布'/ tables / Sate_Customer \ n

我成功地能够在同一个数据库中的'Customer'和'State'表中插入。顺便说一下,此表中的CustomerId和StateId列有一个FK约束。

public class State_Customer
{
    [JsonProperty(PropertyName = "id")]
    public string StateCustomerId { set; get; }

    [JsonProperty(PropertyName = "CustomerId")]
    public string CustomerId { set; get; }

    [JsonProperty(PropertyName = "StateId")]
    public string StateId { set; get; }

    [JsonProperty(PropertyName = "createdAt")]
    [CreatedAt]
    public DateTime CreatedAt { set; get; }

    [JsonProperty(PropertyName = "updatedAt")]
    [UpdatedAt]
    public DateTime UpdatedAt { set; get; }

    [JsonProperty(PropertyName = "deleted")]
    [Deleted]
    public bool Deleted { set; get; }

}

public async void InsertStateCustomer()
{
    List<string> custIds = new List<string>() 
    { "b1f57a2e-aeb4-4709-8b9a-cc5f35c4195f", 
      "f3a9035a-9869-42b9-a415-a8fa0d689c60" 
    };
    string stId = "899becd5-199e-43b4-a4cc-f8883d0b8102";

    foreach (string strCusId in custIds)
    {
        State_Customer stCust = new State_Customer() 
        { CustomerId = strCusId, StateId = stId };

            await stateCustomerTable.InsertAsync(stCust);
    }

0 个答案:

没有答案