Error: DbArithmeticExpression arguments must have a numeric common type.

From time to time you need to filter data by difference between two dates. For instance, you wanna take a difference between date from a record and Today.

Standard LINQ request will fail with the statement like the following:

In Entity Framework version 4 the new utility class has been introduced – EntityFunctions. With the method of this class you can rewrite the statement above like this:

For someone who cannot use EntityFunctions for any reason there is a workaround. Long story short, you should compare the dates. The following changes might be done:

No Comments

You can leave the first : )

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.