Search code examples
linqoracleentity-frameworkdevart

Devart InsertAllOnSubmit doesn't update db generated fields


I'm using Devart's Linq to Oracle components. I've got a table with a field that's updated via a sequence in the database. This works fine when inserting one row:

Dim db As New DataContext

db.MyObjects.InsertOnSubmit(MyObject)

db.SubmitChanges()

At this point, MyObject.Version will contain the version identifier that was generated in the database. So I was expecting that this code would work fine:

Dim db As New DataContext

db.MyObjects.InsertAllOnSubmit(MyObjectsList)

db.SubmitChanges()

But when I do this, the Version field is unchanged in all of the objects in MyObjectsList, even though the rows are being added to the table.

What am I missing here? Thanks in advance.


Solution

  • Well, I found the problem and it had nothing to do with devart. The problem turned out to be that I was passing an IEnumerable(Of MyObject) to the method, which was the result of another query. When I materialized this list to a List(Of MyObject) and passed that instead, the db generated fields did appear in my objects. I must admit I don't quite understand why this mattered, but at any rate it fixed the problem. Hope this helps someone else some time