首页 > 解决方案 > IMobileServiceTable 无法发布

问题描述

我正在尝试在 Azure 表中插入一行,但出现错误:

无法 POST '/tables/Sate_Customer\n

我能够成功地插入同一数据库中的“客户”和“状态”表。顺便说一下,这个表中的 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);
    }

标签: c#asp.net-mvcazurexamarinazure-sql-database

解决方案


推荐阅读