You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Casting a int to a nullable int will throw an error when using linq to entities"Only parameterless constructors and initializers are supported in LINQ to Entities"
#44
Using an expression in the following format - MyDbSet.Select("new (int?(Id))") will throw an error if the Id property is of type int. This seems to be a bug in the original System.Linq.Dynamic project too.
One work around I have found is you can cast it to int64 first and then a nullable int like so MyDbSet.Select("new (int?(int64(Id)))")
The error only gets thrown once you try to evaluate the expression e.g. calling Count() on the first example
The text was updated successfully, but these errors were encountered:
Using an expression in the following format -
MyDbSet.Select("new (int?(Id))")
will throw an error if the Id property is of type int. This seems to be a bug in the original System.Linq.Dynamic project too.One work around I have found is you can cast it to int64 first and then a nullable int like so
MyDbSet.Select("new (int?(int64(Id)))")
The error only gets thrown once you try to evaluate the expression e.g. calling
Count()
on the first exampleThe text was updated successfully, but these errors were encountered: