建议增加 DisableExtendsID 方法或 FixedIDName 方法 #1342

Open
opened 2019-07-02 12:56:18 +00:00 by yokesnowwolf · 0 comments
yokesnowwolf commented 2019-07-02 12:56:18 +00:00 (Migrated from github.com)

一个 model 有定义主键字段,带extends 字段,当 extends 字段类型结构体中也定义了主键字段时,不采用 where 方式 调用 session.ID(pkVal).Get 方法报错如下:
ID condition is error, expect 3 primarykeys, there are 1

很多时候都会一个 model 引用另一个 model 吧,这个时候没必要为了这个单独又添加个只是少个 pk标记或字段的 model.

建议增加方法指定不进行 extends 字段的主键处理,如 session.DisableExtendsID()
或增加方法强制指定主键字段,如 session.FixedIDName(“id”)

一个 model 有定义主键字段,带extends 字段,当 extends 字段类型结构体中也定义了主键字段时,不采用 where 方式 调用 session.ID(pkVal).Get 方法报错如下: ID condition is error, expect 3 primarykeys, there are 1 很多时候都会一个 model 引用另一个 model 吧,这个时候没必要为了这个单独又添加个只是少个 pk标记或字段的 model. 建议增加方法指定不进行 extends 字段的主键处理,如 session.DisableExtendsID() 或增加方法强制指定主键字段,如 session.FixedIDName(“id”)
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1342
No description provided.