Is there any demo to insert a new record into a table with identity primary key using Subsonic 3?
是否有任何演示使用Subsonic 3将新记录插入带有标识主键的表中?
3 个解决方案
#1
-
Create DAL object
创建DAL对象
-
Assign values to all properties except primary key property
将值分配给除主键属性之外的所有属性
Call Save()
Subsonic takes care of the identity keys itself you need not worry.
Subsonic负责处理您不必担心的身份密钥。
#3
I don't know if this has made it to the current version, but Rob showed an example to use a lambda expression to insert a record:
我不知道这是否已成为当前版本,但Rob展示了一个使用lambda表达式插入记录的示例:
db.Insert.Into<Northwind.Region>(x => x.RegionID, x => x.RegionDescription)
.Values(6, "Hawaii").Execute();
http://blog.wekeroad.com/subsonic/subsonic-3-0-preview-1-linq-has-landed/
#1
-
Create DAL object
创建DAL对象
-
Assign values to all properties except primary key property
将值分配给除主键属性之外的所有属性
Call Save()
Subsonic takes care of the identity keys itself you need not worry.
Subsonic负责处理您不必担心的身份密钥。
#2
#3
I don't know if this has made it to the current version, but Rob showed an example to use a lambda expression to insert a record:
我不知道这是否已成为当前版本,但Rob展示了一个使用lambda表达式插入记录的示例:
db.Insert.Into<Northwind.Region>(x => x.RegionID, x => x.RegionDescription)
.Values(6, "Hawaii").Execute();
http://blog.wekeroad.com/subsonic/subsonic-3-0-preview-1-linq-has-landed/