I'm currently using an F# sql type provider to migrate some data between one database to another.
I need to be able to insert identity information (numeric ID column).
The schema for the table has the Id
column as being identity.
I've run a script to set identity_insert
to ON
so that should all be fine.
The issue is that the type-provider-generated insert doesn't actually bother writing the ID value as part of the statement.
Is there a way of forcing it to do so?
Here's what I did to meet a deadline. It's nowhere near ideal but does insert the record with the 'correct' identity.
Edit
Turns out
DataContext.ExecuteCommand()
will fail if one of the parameters isnull
because it can't infer the type and assumesObject
I ended up switching to Seekwell (nuget package I wrote) which actually looks a bit cleaner too, given you don't have to deal with parameter ordering.