Details
-
New Feature
-
Resolution: Unresolved
-
Minor - P4
-
None
-
1.7
-
None
-
Fully Compatible
Description
In LINQ2SQL I could wrote:
public static int? GetIDByHash(this IQueryable<Picture> source, byte[] hash) |
{
|
return |
source
|
.Where(p_ => p_.Hash == hash)
|
.Select(p_ => (int?)p_.ID) |
.SingleOrDefault();
|
}
|
But in LINQ in MongoDB i can't do this. I have to do so:
public static int? GetIDByHash(this IQueryable<Picture> source, byte[] hash) |
{
|
var pic = source.SingleOrDefault(p => p.Hash == hash); |
return pic != null ? pic.ID : default(int?); |
}
|
This saddens me.
The same issue appears with the Cast<int?>() operator.