Leo
Leo

Reputation:

Is there any demo to insert a new record into a table with identity primary key using Subsonic 3?

Is there any demo to insert a new record into a table with identity primary key using Subsonic 3?

Upvotes: 0

Views: 214

Answers (3)

Jürgen Steinblock
Jürgen Steinblock

Reputation: 31743

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:

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/

Upvotes: 0

TheVillageIdiot
TheVillageIdiot

Reputation: 40537

  1. Create DAL object

  2. Assign values to all properties except primary key property

  3. Call Save()

Subsonic takes care of the identity keys itself you need not worry.

Upvotes: 2

Related Questions