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
LINQ: Prevent using server-side Distinct() together with projection methods executed locally, since the distinct would operate on the values before the local method is called.
ShipCountry=x.ShippingAddress.Country.ToLower(),// Should be translated to HQL/SQL.
92
+
ShippingDate=x.ShippingDate,
93
+
OrderDate=x.OrderDate.Value.Date,
94
+
})
95
+
.Distinct()
96
+
.ToArray();
97
+
98
+
result.Length.Should().Be.EqualTo(824);
99
+
}
100
+
101
+
[Test]
102
+
[ExpectedException(typeof(NotSupportedException),ExpectedMessage="Cannot use distinct on result that depends on methods for which no SQL equivalent exist.")]
@@ -91,8 +112,23 @@ public void DistinctOnTypeProjectionWithCustomProjectionMethods()
91
112
})
92
113
.Distinct()
93
114
.ToArray();
115
+
}
94
116
95
-
result.Length.Should().Be.EqualTo(774);
117
+
118
+
[Test]
119
+
[ExpectedException(typeof(NotSupportedException),ExpectedMessage="Cannot use distinct on result that depends on methods for which no SQL equivalent exist.")]
0 commit comments