@@ -46,8 +46,7 @@ internal IKey FindKey<T>(object[] keys, out MethodInfo find)
4646 {
4747 ( var keyTypes , var key , find ) = entityKeyMap [ typeof ( T ) ] ;
4848
49- var inputKeyTypes = keys . Select ( _ => _ . GetType ( ) ) . ToList ( ) ;
50- if ( keyTypes . SequenceEqual ( inputKeyTypes ) )
49+ if ( KeyTypesMatch ( keyTypes , keys ) )
5150 {
5251 return key ;
5352 }
@@ -57,17 +56,33 @@ internal IKey FindKey<T>(object[] keys, out MethodInfo find)
5756
5857 IEnumerable < ( IKey key , MethodInfo find ) > FindKeys ( object [ ] keys )
5958 {
60- var inputKeyTypes = keys . Select ( _ => _ . GetType ( ) ) . ToArray ( ) ;
61-
6259 foreach ( var ( keyTypes , key , find ) in entityKeyMap . Values )
6360 {
64- if ( keyTypes . SequenceEqual ( inputKeyTypes ) )
61+ if ( KeyTypesMatch ( keyTypes , keys ) )
6562 {
6663 yield return new ( key , find ) ;
6764 }
6865 }
6966 }
7067
68+ static bool KeyTypesMatch ( Type [ ] keyTypes , object [ ] keys )
69+ {
70+ if ( keyTypes . Length != keys . Length )
71+ {
72+ return false ;
73+ }
74+
75+ for ( var i = 0 ; i < keyTypes . Length ; i ++ )
76+ {
77+ if ( keyTypes [ i ] != keys [ i ] . GetType ( ) )
78+ {
79+ return false ;
80+ }
81+ }
82+
83+ return true ;
84+ }
85+
7186 internal static Task < object ? > InvokeFind ( TDbContext context , bool ignoreFilters , object [ ] keys , MethodInfo find , IKey key ) =>
7287 ( Task < object ? > ) find . Invoke (
7388 null ,
0 commit comments