Skip to content

Error with enums in relational entity into UpdateFromQuery #30

@nebre

Description

@nebre

Hi,

When I try to filter from a relational enum, like this:

unitOfWork.Set<ClientContact>()
                    .Where(x => x.Client.Status == ClientsClientStatusEnum.Pending)
                    .UpdateFromQuery<ClientContact>(x => new ClientContact() { Code = "something" });

This try to update the Entity with this query:

exec sp_executesql N'MERGE INTO [Clients].[ClientContacts] AS DestinationTable
USING
(
SELECT 
    [Extent2].[StatusValue] AS [StatusValue], 
    [Extent1].[Id] AS [Id]
    FROM  [Clients].[ClientContacts] AS [Extent1]
    INNER JOIN [Clients].[Clients] AS [Extent2] ON [Extent1].[ClientId] = [Extent2].[Id]
    WHERE ([Extent2].[StatusValue] IN (3, 4))
) AS StagingTable
ON StagingTable.StatusValue = DestinationTable.StatusValue AND StagingTable.Id = DestinationTable.Id
WHEN MATCHED THEN
    UPDATE
    SET     [Code] = @zzzupdate_1
;',N',@zzzupdate_1 nvarchar(4)',@zzzupdate_1=N'something'

As you could show, it try to compare this enum into two different entities, because on stagingTable is from Clients and try to filter into ClientContacts

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions