When using decimal literals: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Wain123
Posts: 12
Joined: Wed 07 Jun 2017 07:25

When using decimal literals: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Post by Wain123 » Wed 21 Jun 2017 12:53

I have a NUMBER(28,12) column mapped to a decimal? property. The following code throws a System.InvalidOperationException: 'The operands for operator 'Equal' do not match the parameters of method 'op_Equality'.'

Code: Select all

Console.WriteLine(ctx.Test.Where(z => z.Num == 5m).Count());
On the other hand, the following code works correctly:

Code: Select all

decimal d = 5m;
Console.WriteLine(ctx.Test.Where(z => z.Num == d).Count());

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: When using decimal literals: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Post by Shalex » Fri 30 Jun 2017 09:31

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: When using decimal literals: "The operands for operator 'Equal' do not match the parameters of method 'op_Equality'."

Post by Shalex » Fri 04 Aug 2017 16:07

The bug with comparison and binary operations in EF Core is fixed: viewtopic.php?f=1&t=35777.

Post Reply