Micro ORM Dapper 找不到类型的键 属性

Micro ORM Dapper Could not find the key property for type

我是 Micro-ORM 的新手,我正在使用精巧的流畅映射和 dommel 我尝试 insert/add 条目,但遇到此错误 "Could not find the key property for type" 这是我的代码

        using (IDbConnection con = new MySqlConnection(cnxStr))
        {
            con.Open();
            equipment eqp = new equipment 
            {
                category_id     = 1, 
                barcode         = "DDH-003",
                asset_number    = "45645645", 
                equipment_name  = "DBD Dew", 
                equipment_description = "Thin Can", 
                manufacturer_id = 3, 
                model           = "Blah", 
                serialnumber    = "11111", 
                status          = "Good", 
                service_group   = "SGE", 
                required_pm     = "Yes", 
                service_provider="111", 
                frequency       = 1, 
                department_id   = 1, 
                location_id     = 1, 
                availability    = "Avail", 
                register_id     = 1, 
                supplier_id     = 1, 
                conditionstatus_id = 1, 
                status_id       = 1, 
                utilization_id = 3
            };
            int count = con.Insert<equipment>(eqp); <-- error here
            if (count > 0) 
            {
                MessageBox.Show("Successfully Added", "Successfully Added -:", MessageBoxButtons.OK, MessageBoxIcon.Information); 
            }
            con.Close();

        }

Dapper 假设您的数据库模型中有一个名为 Id 的列,除非您另有说明。另一方面,在这种情况下,您使用的是 Dapper.Contrib 的扩展名。为此,您必须在主键上方添加指令 [key]