Unfortunately I'm stuck using this basically undocumented/obsolete library (SubSonic 2.0). I'm trying to do a simple identity insert but I can't seem to get it to work.
Here's the psuedo-code version of what I'm trying to do:
SubSonicExampleObject o = new Select()
.From(SubSonicExampleObject.Schema)
.Where(SubSonicExampleObject.IdColumn)
.IsEqualTo(124124)
.ExecuteSingle<SubSonicExampleObject>();
if(o == null)
{
o = new SubSonicExampleObject();
o.Id = 124124;
o.Save();
}
I've also tried adding this code above and below this statement, to no success:
new InlineQuery()
.Execute("SET IDENTITY_INSERT " + SubSonicExampleObject.Schema + " ON");
[CODE ABOVE]
new InlineQuery()
.Execute("SET IDENTITY_INSERT " + SubSonicExampleObject.Schema + " OFF");
Regardless of what I do, SubSonic seems to be ignoring the ID value, and setting it based on the next identity value.
If anyone knows how to do this, I'd be super duper happy!