I'm using a type provider to insert data into a SQL Server database. I want the IDs of the entries I just inserted. In C#, I could access the IDs from "foo" after calling SubmitChanges(). This doesn't happen for me in F#. Does it have something to do with immutability? Is there a way to access these IDs without having to make another call to the DB?
foo
|> dbContext.MyTable.InsertAllOnSubmit
dbContext.DataContext.SubmitChanges()
//data in foo gets added, but Ids are all 0.
//In MyTable, Id is an int identity(1,1) primary key
Sorry, I didn't point out that foo was a seq. That appeared to be the issue.
Doing a |> Seq.toList on foo before InsertAllOnSubmit did the trick and I am now able to see IDs.