It seems that Entity Framework is not able to compare a value against null if that null value is stored in a variable: http://data.uservoice.com/forums/72025-ado-net-entity-framework-ef-feature-suggestions/suggestions/1015361-incorrect-handling-of-null-variables-in-where-cl?ref=title
So I'm doing something like this as suggested by other users of SO:
string description = null;
var transactions = from t in entities.Transactions
where description == null ? t.Description == null : t.Description == description
select t;
While this technique works perfectly fine when dealing with int? or double?, SQL Server Compact throws an EntityCommandExecutionException when using strings (as in the example above). The exception contains the following details:
InnerException: System.Data.SqlServerCe.SqlCeException
Message=The specified argument value for the function is not valid. [ Argument # = 1,Name of function(if known) = isnull ]
Source=SQL Server Compact ADO.NET Data Provider
Any idea why I'm getting this and how I can overcome it?