How can I perform an idempotent insert row using subsonic with a SQL 2008 backend?

Posted by Jason Hernandez on Stack Overflow See other posts from Stack Overflow or by Jason Hernandez
Published on 2010-03-18T20:03:48Z Indexed on 2010/03/19 12:51 UTC
Read the original article Hit count: 263

Filed under:
|
|
|

How can I perform an idempotent insert row using subsonic with a SQL 2008 backend?

e.g.

I have a table "Colors" where name is the primary key.

Color c = new Color;
c.name = "red";
c.Save;

Color c2 = new Color;
c2.name = "red";
c2.Save; // throws duplicate key error;

I know I can just trap the error but I would prefer to do something like REPLACE in MySql

© Stack Overflow or respective owner

Related posts about subsonic3

Related posts about insert