@@ -675,6 +675,17 @@ public static dynamic FirstOrDefault([NotNull] this IQueryable source, [NotNull]
675675 /// </example>
676676 [ PublicAPI ]
677677 public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , [ NotNull ] string resultSelector , object [ ] args )
678+ {
679+ return InternalGroupBy ( source , config , keySelector , resultSelector , null , args ) ;
680+ }
681+
682+ // NEED TEXT!
683+ public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , [ NotNull ] string resultSelector , IEqualityComparer equalityComparer , object [ ] args )
684+ {
685+ return InternalGroupBy ( source , config , keySelector , resultSelector , equalityComparer , args ) ;
686+ }
687+
688+ internal static IQueryable InternalGroupBy ( [ NotNull ] IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , [ NotNull ] string resultSelector , IEqualityComparer equalityComparer , object [ ] args )
678689 {
679690 Check . NotNull ( source , nameof ( source ) ) ;
680691 Check . NotNull ( config , nameof ( config ) ) ;
@@ -684,11 +695,24 @@ public static IQueryable GroupBy([NotNull] this IQueryable source, [NotNull] Par
684695 bool createParameterCtor = config ? . EvaluateGroupByAtDatabase ?? SupportsLinqToObjects ( config , source ) ;
685696 LambdaExpression keyLambda = DynamicExpressionParser . ParseLambda ( config , createParameterCtor , source . ElementType , null , keySelector , args ) ;
686697 LambdaExpression elementLambda = DynamicExpressionParser . ParseLambda ( config , createParameterCtor , source . ElementType , null , resultSelector , args ) ;
687-
688- var optimized = OptimizeExpression ( Expression . Call (
689- typeof ( Queryable ) , nameof ( Queryable . GroupBy ) ,
690- new [ ] { source . ElementType , keyLambda . Body . Type , elementLambda . Body . Type } ,
691- source . Expression , Expression . Quote ( keyLambda ) , Expression . Quote ( elementLambda ) ) ) ;
698+
699+ Expression optimized = null ;
700+ if ( equalityComparer == null )
701+ {
702+ optimized = OptimizeExpression ( Expression . Call (
703+ typeof ( Queryable ) , nameof ( Queryable . GroupBy ) ,
704+ new [ ] { source . ElementType , keyLambda . Body . Type , elementLambda . Body . Type } ,
705+ source . Expression , Expression . Quote ( keyLambda ) , Expression . Quote ( elementLambda ) ) ) ;
706+ }
707+ else
708+ {
709+ var equalityComparerGenericType = typeof ( IEqualityComparer < > ) . MakeGenericType ( keyLambda . Body . Type ) ;
710+ optimized = OptimizeExpression ( Expression . Call (
711+ typeof ( Queryable ) , nameof ( Queryable . GroupBy ) ,
712+ new [ ] { source . ElementType , keyLambda . Body . Type , elementLambda . Body . Type } ,
713+ source . Expression , Expression . Quote ( keyLambda ) , Expression . Quote ( elementLambda ) ,
714+ Expression . Constant ( equalityComparer , equalityComparerGenericType ) ) ) ;
715+ }
692716
693717 return source . Provider . CreateQuery ( optimized ) ;
694718 }
@@ -700,6 +724,12 @@ public static IQueryable GroupBy([NotNull] this IQueryable source, [NotNull] str
700724 return GroupBy ( source , ParsingConfig . Default , keySelector , resultSelector , args ) ;
701725 }
702726
727+ // NEED TEXT!
728+ public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] string keySelector , [ NotNull ] string resultSelector , IEqualityComparer equalityComparer , object [ ] args )
729+ {
730+ return GroupBy ( source , ParsingConfig . Default , keySelector , resultSelector , equalityComparer , args ) ;
731+ }
732+
703733 /// <summary>
704734 /// Groups the elements of a sequence according to a specified key string function
705735 /// and creates a result value from each group and its key.
@@ -717,7 +747,7 @@ public static IQueryable GroupBy([NotNull] this IQueryable source, [NotNull] str
717747 /// </example>
718748 public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , [ NotNull ] string resultSelector )
719749 {
720- return GroupBy ( source , config , keySelector , resultSelector , null ) ;
750+ return GroupBy ( source , config , keySelector , resultSelector , null , null ) ;
721751 }
722752
723753 /// <inheritdoc cref="GroupBy(IQueryable, ParsingConfig, string, string)"/>
@@ -726,6 +756,18 @@ public static IQueryable GroupBy([NotNull] this IQueryable source, [NotNull] str
726756 return GroupBy ( source , ParsingConfig . Default , keySelector , resultSelector ) ;
727757 }
728758
759+ // NEED TEXT!
760+ public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , [ NotNull ] string resultSelector , IEqualityComparer equalityComparer )
761+ {
762+ return InternalGroupBy ( source , config , keySelector , resultSelector , equalityComparer , null ) ;
763+ }
764+
765+ // NEED TEXT!
766+ public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] string keySelector , [ NotNull ] string resultSelector , IEqualityComparer equalityComparer )
767+ {
768+ return GroupBy ( source , ParsingConfig . Default , keySelector , resultSelector , equalityComparer ) ;
769+ }
770+
729771 /// <summary>
730772 /// Groups the elements of a sequence according to a specified key string function
731773 /// and creates a result value from each group and its key.
@@ -743,6 +785,17 @@ public static IQueryable GroupBy([NotNull] this IQueryable source, [NotNull] str
743785 /// </example>
744786 [ PublicAPI ]
745787 public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , [ CanBeNull ] params object [ ] args )
788+ {
789+ return InternalGroupBy ( source , config , keySelector , null , args ) ;
790+ }
791+
792+ // NEED TEXT!
793+ public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , IEqualityComparer equalityComparer , [ CanBeNull ] params object [ ] args )
794+ {
795+ return InternalGroupBy ( source , config , keySelector , equalityComparer , args ) ;
796+ }
797+
798+ internal static IQueryable InternalGroupBy ( [ NotNull ] IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string keySelector , IEqualityComparer equalityComparer , [ CanBeNull ] params object [ ] args )
746799 {
747800 Check . NotNull ( source , nameof ( source ) ) ;
748801 Check . NotNull ( config , nameof ( config ) ) ;
@@ -751,9 +804,22 @@ public static IQueryable GroupBy([NotNull] this IQueryable source, [NotNull] Par
751804 bool createParameterCtor = config ? . EvaluateGroupByAtDatabase ?? SupportsLinqToObjects ( config , source ) ;
752805 LambdaExpression keyLambda = DynamicExpressionParser . ParseLambda ( config , createParameterCtor , source . ElementType , null , keySelector , args ) ;
753806
754- var optimized = OptimizeExpression ( Expression . Call (
755- typeof ( Queryable ) , nameof ( Queryable . GroupBy ) ,
756- new [ ] { source . ElementType , keyLambda . Body . Type } , source . Expression , Expression . Quote ( keyLambda ) ) ) ;
807+ Expression optimized = null ;
808+
809+ if ( equalityComparer == null )
810+ {
811+ optimized = OptimizeExpression ( Expression . Call (
812+ typeof ( Queryable ) , nameof ( Queryable . GroupBy ) ,
813+ new [ ] { source . ElementType , keyLambda . Body . Type } , source . Expression , Expression . Quote ( keyLambda ) ) ) ;
814+ }
815+ else
816+ {
817+ var equalityComparerGenericType = typeof ( IEqualityComparer < > ) . MakeGenericType ( keyLambda . Body . Type ) ;
818+ optimized = OptimizeExpression ( Expression . Call (
819+ typeof ( Queryable ) , nameof ( Queryable . GroupBy ) ,
820+ new [ ] { source . ElementType , keyLambda . Body . Type } , source . Expression , Expression . Quote ( keyLambda ) ,
821+ Expression . Constant ( equalityComparer , equalityComparerGenericType ) ) ) ;
822+ }
757823
758824 return source . Provider . CreateQuery ( optimized ) ;
759825 }
@@ -764,6 +830,13 @@ public static IQueryable GroupBy([NotNull] this IQueryable source, [NotNull] str
764830 {
765831 return GroupBy ( source , ParsingConfig . Default , keySelector , args ) ;
766832 }
833+
834+ // NEED TEXT!
835+ public static IQueryable GroupBy ( [ NotNull ] this IQueryable source , [ NotNull ] string keySelector , IEqualityComparer equalityComparer , [ CanBeNull ] params object [ ] args )
836+ {
837+ return GroupBy ( source , ParsingConfig . Default , keySelector , equalityComparer , args ) ;
838+ }
839+
767840 #endregion GroupBy
768841
769842 #region GroupByMany
@@ -1322,6 +1395,12 @@ public static IOrderedQueryable OrderBy([NotNull] this IQueryable source, [NotNu
13221395 return InternalOrderBy ( source , config , ordering , null , args ) ;
13231396 }
13241397
1398+ // NEED TEXT!
1399+ public static IOrderedQueryable OrderBy ( [ NotNull ] this IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string ordering , IComparer comparer , params object [ ] args )
1400+ {
1401+ return InternalOrderBy ( source , config , ordering , comparer , args ) ;
1402+ }
1403+
13251404 internal static IOrderedQueryable InternalOrderBy ( [ NotNull ] IQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string ordering , IComparer comparer , params object [ ] args )
13261405 {
13271406 Check . NotNull ( source , nameof ( source ) ) ;
@@ -1362,6 +1441,12 @@ internal static IOrderedQueryable InternalOrderBy([NotNull] IQueryable source, [
13621441 public static IOrderedQueryable OrderBy ( [ NotNull ] this IQueryable source , [ NotNull ] string ordering , params object [ ] args )
13631442 {
13641443 return OrderBy ( source , ParsingConfig . Default , ordering , args ) ;
1444+ }
1445+
1446+ // NEED TEXT!
1447+ public static IOrderedQueryable OrderBy ( [ NotNull ] this IQueryable source , [ NotNull ] string ordering , IComparer comparer , params object [ ] args )
1448+ {
1449+ return OrderBy ( source , ParsingConfig . Default , ordering , comparer , args ) ;
13651450 }
13661451
13671452 #endregion OrderBy
@@ -2272,7 +2357,13 @@ public static IOrderedQueryable ThenBy([NotNull] this IOrderedQueryable source,
22722357 return InternalThenBy ( source , config , ordering , null , args ) ;
22732358 }
22742359
2275- internal static IOrderedQueryable InternalThenBy ( [ NotNull ] this IOrderedQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string ordering , IComparer comparer , params object [ ] args )
2360+ // NEED TEXT!
2361+ public static IOrderedQueryable ThenBy ( [ NotNull ] this IOrderedQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string ordering , IComparer comparer , params object [ ] args )
2362+ {
2363+ return InternalThenBy ( source , config , ordering , comparer , args ) ;
2364+ }
2365+
2366+ internal static IOrderedQueryable InternalThenBy ( [ NotNull ] IOrderedQueryable source , [ NotNull ] ParsingConfig config , [ NotNull ] string ordering , IComparer comparer , params object [ ] args )
22762367 {
22772368 Check . NotNull ( source , nameof ( source ) ) ;
22782369 Check . NotNull ( config , nameof ( config ) ) ;
@@ -2314,6 +2405,12 @@ public static IOrderedQueryable ThenBy([NotNull] this IOrderedQueryable source,
23142405 return ThenBy ( source , ParsingConfig . Default , ordering , args ) ;
23152406 }
23162407
2408+ // NEED TEXT!
2409+ public static IOrderedQueryable ThenBy ( [ NotNull ] this IOrderedQueryable source , [ NotNull ] string ordering , IComparer comparer , params object [ ] args )
2410+ {
2411+ return ThenBy ( source , ParsingConfig . Default , ordering , comparer , args ) ;
2412+ }
2413+
23172414 #endregion OrderBy
23182415
23192416 #region Where
0 commit comments