【发布时间】:2021-04-29 07:36:53
【问题描述】:
我有这个结构:
@JsonSerializable()
class Media {
@Id(assignable: true)
int id = 0;
int lid = 0;
String url = '';
String? title;
}
@Entity()
class NewsPicture extends Media {
@override
@Id(assignable: true)
int id = 0;
@Backlink('newsPicture')
final news = ToOne<News>();
}
@JsonSerializable(explicitToJson: true)
@Entity()
class News extends Data<News> implements DataInterface<News> {
@Id(assignable: true)
@JsonKey(defaultValue: 0)
int lid = 0;
final Picture = ToMany<NewsPicture>();
}
在生成过程中,objectbox_generator:resolver 给了我这个错误信息:
@Backlink() 注释的无效使用 - 只能用于 ToMany 字段
为什么不允许?我错过了什么?
【问题讨论】: