我在 Mono 上使用 OrmLite 和 F#。
我有以下基本结构:
type NestedTree() =
static member val table_name = String.Empty with get, set
//DB fields
[<AutoIncrement>]
[<PrimaryKey>]
member val id = 0 with get, set
member val parent_id = Nullable<_>(null) with get, set
member val name = String.Empty with get, set
member val lft = 0 with get, set
member val rgt = 0 with get, set
member val depth = 0 with get, set
但是,当我使用时不考虑 Autoncrement 属性:
use conn = dbFactory.Open()
let item = ...
conn.Insert(item)
我认为这是因为 F# 中的默认值设置为 0。
我错了吗 ?如果没有,有没有办法绕过它?
非常感谢您的帮助 !