The InsertWithOutputIntoAsync method does not work correctly
See original GitHub issueHi, I wanted to call the InsertWithOutputIntoAsync method with the following request:
await source.InsertWithOutputIntoAsync(
targetTable,
valueFromTargetTable=> valueFromTargetTable,
otherTable,
valueFromTargetTable=> new OtherClass
{
Id = valueFromTargetTable.Id,
Status = 1
});
But I caught an exception when calling such code:
System.InvalidCastException : Unable to cast object of type 'LinqToDB.Linq.Table`1[OtherTable]' to type 'System.Linq.IQueryable`1[TargetTable]'
When I started looking at the source code, what I saw was that the method has this code (IQueryable<TTarget>)outputTable
link to the source:
https://github.com/linq2db/linq2db/blob/master/Source/LinqToDB/LinqExtensions.Insert.cs/#L300
Why do you need a type conversion? The semantics of the method allows you to call the code that I have.
Issue Analytics
- State:
- Created 7 months ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Release Notes 3.0.0
With this release we fix escaping logic for database objects (e.g. table, schema, column, database, alias) and remove couple of quirks in ...
Read more >linq2db.EntityFrameworkCore - bytemeta
linq2db.EntityFrameworkCore repo issues. ... UnwrapDataObjectInterceptor not beign called ... The InsertWithOutputIntoAsync method does not work correctly.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hmm, that’s what you get when doesn’t cover all API overloads with tests. COuple more places:
https://github.com/linq2db/linq2db/blob/master/Source/LinqToDB/LinqExtensions.Insert.cs/#L717 and https://github.com/linq2db/linq2db/blob/master/Source/LinqToDB/LinqExtensions.Insert.cs/#L764
Thanks!