gpt4 book ai didi

c# - 无法确定 Azure 移动服务 DataObject 中类型的复合主键排序

转载 作者:行者123 更新时间:2023-11-29 10:54:29 25 4
gpt4 key购买 nike

我有 Azure 移动服务,它正在从单个(只需要这一张表的数据)wordpress wp_posts 表中获取数据。

在模型类中,我为主键定义了[Key]。表wp_posts只有一个PK 但我收到错误 -

Unable to determine composite primary key ordering for type

我需要针对表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; }
}

表结构 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 移动应用对该表有一些相当严格的要求,以便它可以用于离线同步。请参阅 http://aka.ms/zumobook 的第 3 章了解详情。

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

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

关于c# - 无法确定 Azure 移动服务 DataObject 中类型的复合主键排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43212459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com