Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetOutputIdentity: true broken since update to .Net 9.0 #1646

Open
angelaki opened this issue Dec 19, 2024 · 6 comments
Open

SetOutputIdentity: true broken since update to .Net 9.0 #1646

angelaki opened this issue Dec 19, 2024 · 6 comments
Labels

Comments

@angelaki
Copy link

I'm not quite sure (yet) if this issue was caused by an update of this lib or .Net 9.0 but right now the returned Ids are totally wrong! They weren't before my update. Is anyone already aware of this? Meanwhile I'm checking if the issue is caused by .Net 9.0 or this lib.

@angelaki
Copy link
Author

The issue was introduced with 8.1.2. - no relation to .Net 9.0 as far as I can tell. 9.0.0-rc.1 doesn't seam to solve it!

@jhfreestyle
Copy link

Hi,
could it be related to this recent commit ?
#1578
#1578
I'm experiencing same issue since upgrade from 8.0.2 to 8.1.2, using sqlserver.
Return ids are wrong and mess up all related entites.

@borisdj
Copy link
Owner

borisdj commented Dec 24, 2024

Is this on SqlServer and are you using just BulkInsert or BulkInsertOrUpdate, or combining it also with IncludeGraph?
And can you make a reproducale test.
Could be the same issue as #1629

@jhfreestyle
Copy link

Yes similar ! Using sqlserver, bulkinsertOrUpdate with setOutputId true and preserveOrder true. I'm also preloading new entites with id from -count to -1 (instead 0)
Will do more tests in coming days after christmas
Thanks

@angelaki
Copy link
Author

Maybe I find some time for a repro in the first days of January. But yeah, guess could be related to this commit, checked the history myself and thought, that it actually could only be this one.

@PhideasAmbrosianus
Copy link

PhideasAmbrosianus commented Jan 11, 2025

I can confirm I am seeing the same thing. Not sure if it's broken on everything or not, it seems like sometimes it's working and sometimes it is not for me.

I went from 3.1.1 to 3.1.2 and then I experienced the issue. I am replicating in MSSQL EXPRESS.

I am NOT using .NET 9, still on .NET 8

My implementation is this:

// After this write, I check database and Ids SQL database assigned are not set back properly
await _context.BulkInsertAsync(SampleRecords, new BulkConfig { SetOutputIdentity = true });

No includes or graphs and this fails.

I noticed that in 3.1.1, the Ids database assigns are in order of the List I am providing to BulkInsertAsync.
In 3.1.2, the Ids aren't sequentially ordered - they're all there but kind of random.

The table in question does have navigations to other tables - but I also see it working correctly in navigations with other tables. I cannot see any logical pattern that causes one insert set to work Vs. others. In this app, I am doing multiple different BulkInserts of different types and some of them the Ids are assigned right and some are not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants