无法确定 Azure 移动服务数据对象中类型的复合主键顺序

Unable to determine composite primary key ordering for type in Azure Mobile service DataObject

我有 Azure Mobile Service 正在从单个(只需要这个 table )wordpress wp_posts table.

获取数据

在模型 class 中,我为 Primary Key 定义了 [Key] 。table wp_posts 只有一个 PK 但是我收到错误 -

Unable to determine composite primary key ordering for type

我需要根据 table 定义正确的 composite key wp_posts 谁能找到方法?

wp_posts.cs

[Table("wp_posts")]
public class wp_posts: EntityData
{
    [Key]
    [Column("ID")]
    public int ID { get; set; }    
    public int post_author { get; set; }    
    public DateTime post_date { get; set; }    
    public DateTime post_date_gmt { get; set; }    
    public string post_content { get; set; }    
    public string post_title { get; set; }
    public string post_excerpt { get; set; }
    public string post_status { get; set; }    
    public string comment_status { get; set; }
    public string ping_status { get; set; }    
    public string post_password { get; set; }    
    public string post_name { get; set; }    
    public string to_ping { get; set; }
    public string pinged { get; set; }
    public DateTime post_modified { get; set; }    
    public DateTime post_modified_gmt { get; set; }
    public string post_content_filtered { get; set; }    
    public int post_parent { get; set; }
    public string guid { get; set; }
    public int menu_order { get; set; }
    public string post_type { get; set; }    
    public string post_mime_type { get; set; }    
    public int comment_count { get; set; }
}

Table wordpress 结构 mySQL 数据库。

Table: wp_posts
    Field   Type    Null    Key Default Extra
    ID  bigint(20) unsigned     PRI & IND Pt4       auto_increment
    post_author bigint(20) unsigned     IND 0    
    post_date   datetime        IND Pt3 0000-00-00 00:00:00  
    post_date_gmt   datetime            0000-00-00 00:00:00  
    post_content    longtext                 
    post_title  text                 
    post_excerpt    text                 
    post_status varchar(20)     IND PT2 publish  
    comment_status  varchar(20)         open     
    ping_status varchar(20)         open     
    post_password   varchar(20)              
    post_name   varchar(200)        IND      
    to_ping text                 
    pinged  text                 
    post_modified   datetime            0000-00-00 00:00:00  
    post_modified_gmt   datetime            0000-00-00 00:00:00  
    post_content_filtered   longtext                
    post_parent bigint(20) unsigned     IND 0    
    guid    varchar(255)                 
    menu_order  int(11)         0    
    post_type   varchar(20)     IND Pt1 post     
    post_mime_type  varchar(100)                 
    comment_count   bigint(20)          0    
    Indexes

    Keyname Type    Field
    PRIMARY PRIMARY ID
    post_name   INDEX   post_name
    type_status_date    INDEX   post_type
    post_status
    post_date
    ID
    post_parent INDEX   post_parent
    post_author INDEX   post_author

Azure Mobile Apps 对 table 有一些相当严格的要求,以便它可以用于离线同步。有关详细信息,请参阅 http://aka.ms/zumobook 的第 3 章。

这个table不符合那些要求。具体来说,ID 不是字符串,没有 updatedAt 或 version 字段。如果您正在执行软删除(在移动应用程序中,您需要这样做),那么您还需要一个已删除的字段。

看看 EntityData class - 您会注意到 ID 字段已经定义并且是您的替代定义。