Open AntonC9018 opened 9 months ago
The logging had to be enabled prior to creating the context, I assume. It did include the ID
column:
OUTPUT
[INSERTED].[CODE],
[INSERTED].[ID]
INTO [tempdb]..[#tempTable]
(
[Code],
[Id]
)
But it still produces the error about missing the ID
column.
Note that ID
is an autoincremented column (identity
+ primary key
in sql server).
I have a situation like this:
A
which is stored in the Db and is registered with EF Core. The column names here are UPPER_SNAKE_CASE.AModel
). This gets the default field names. This data is stored in a temp table with which the merge happens.A
but missing inAModel
(but not the id).A
before doing the merge, which just leavesA
where the company id is some fixed value, if that's relevant.In the merge query, I do an insert of
A
with values fromAModel
as well as the additional context values, setting the missing fields to their default values if needed; I also do an update ofA
for the fields that are present onAModel
. I want to output the result in a temp table asCode
,Id
pairs (both being present onA
, but onlyCode
being present onAModel
). It complains to me thatID
was not found in the query.For the
CreateMappingExpression
, I'm using the 3 parameter overload. It's created in a generic function that knowsTEntity
has aCode
and anId
, but I expect working with generics through interfaces to be allowed by the library:Is it not allowed to output the ids of newly created objects in the output clause? I figure I should just do another query if that's not allowed.
The error I'm seeing is: