Skip to content

Commit ef05909

Browse files
committed
After-review fixes
1 parent 71772a4 commit ef05909

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

Orm/Xtensive.Orm/IoC/ServiceContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected virtual object CreateInstance(ServiceRegistration serviceInfo)
119119
_ = creating.TryRemove(key, out _);
120120
}
121121
#if NET8_0_OR_GREATER
122-
return cInfo.Invoke(new Span<object>(args));
122+
return cInfo.Invoke(args.AsSpan());
123123
#else
124124
return cInfo.Invoke(args);
125125
#endif

Orm/Xtensive.Orm/Orm/Linq/QueryProvider.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,21 @@ public IQueryable<TElement> CreateQuery<TElement>(Expression expression) =>
5353
object IQueryProvider.Execute(Expression expression)
5454
{
5555
var resultType = expression.Type;
56+
#if NET8_0_OR_GREATER
5657
var executeMethod = resultType.IsOfGenericInterface(WellKnownInterfaces.EnumerableOfT)
5758
? WellKnownMembers.QueryProvider.ExecuteSequence.CachedMakeGenericMethodInvoker(SequenceHelper.GetElementType(resultType))
5859
: WellKnownMembers.QueryProvider.ExecuteScalar.CachedMakeGenericMethodInvoker(resultType);
5960
try {
60-
#if NET8_0_OR_GREATER
6161
return executeMethod.Invoke(this, expression);
62+
}
6263
#else
64+
var executeMethod = resultType.IsOfGenericInterface(WellKnownInterfaces.EnumerableOfT)
65+
? WellKnownMembers.QueryProvider.ExecuteSequence.CachedMakeGenericMethod(SequenceHelper.GetElementType(resultType))
66+
: WellKnownMembers.QueryProvider.ExecuteScalar.CachedMakeGenericMethod(resultType);
67+
try {
6368
return executeMethod.Invoke(this, new object[] { expression });
64-
#endif
6569
}
70+
#endif
6671
catch (TargetInvocationException e) {
6772
if (e.InnerException != null) {
6873
ExceptionDispatchInfo.Throw(e.InnerException);

Orm/Xtensive.Orm/Reflection/TypeHelper.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public int GetHashCode((Type, Type[]) obj)
5454
private static readonly string TypeHelperNamespace = typeof(TypeHelper).Namespace;
5555

5656
#if NET8_0_OR_GREATER
57-
private static readonly ConcurrentDictionary<(Type, Type[]), ConstructorInvoker> ConstructorInfoByTypes =
57+
private static readonly ConcurrentDictionary<(Type, Type[]), ConstructorInvoker> ConstructorInvokersByTypes =
5858
#else
5959
private static readonly ConcurrentDictionary<(Type, Type[]), ConstructorInfo> ConstructorInfoByTypes =
6060
#endif
@@ -661,7 +661,7 @@ public static object Activate(this Type type, Type[] genericArguments, params ob
661661
/// </exception>
662662
#if NET8_0_OR_GREATER
663663
public static ConstructorInvoker GetSingleConstructorInvoker(this Type type, Type[] argumentTypes) =>
664-
ConstructorInfoByTypes.GetOrAdd((type, argumentTypes),
664+
ConstructorInvokersByTypes.GetOrAdd((type, argumentTypes),
665665
static t => ConstructorExtractor(t) is ConstructorInfo ctor
666666
? ConstructorInvoker.Create(ctor)
667667
: throw new InvalidOperationException(Strings.ExGivenTypeHasNoOrMoreThanOneCtorWithGivenParameters));
@@ -684,7 +684,7 @@ public static ConstructorInfo GetSingleConstructor(this Type type, Type[] argume
684684
[CanBeNull]
685685
#if NET8_0_OR_GREATER
686686
public static ConstructorInvoker GetSingleConstructorInvokerOrDefault(this Type type, Type[] argumentTypes) =>
687-
ConstructorInfoByTypes.GetOrAdd((type, argumentTypes),
687+
ConstructorInvokersByTypes.GetOrAdd((type, argumentTypes),
688688
static t => ConstructorExtractor(t) is ConstructorInfo ctor ? ConstructorInvoker.Create(ctor) : null);
689689
#else
690690
public static ConstructorInfo GetSingleConstructorOrDefault(this Type type, Type[] argumentTypes) =>
@@ -714,7 +714,6 @@ from pair in zipped
714714
return constructors.SingleOrDefault();
715715
};
716716

717-
718717
/// <summary>
719718
/// Orders the specified <paramref name="types"/> by their inheritance
720719
/// (very base go first).
@@ -956,12 +955,6 @@ public static MethodInvoker CachedMakeGenericMethodInvoker(this MethodInfo gener
956955

957956
public static MethodInvoker CachedMakeGenericMethodInvoker(this MethodInfo genericDefinition, Type typeArgument1, Type typeArgument2) =>
958957
GenericMethodInvokers2.GetOrAdd((genericDefinition, typeArgument1, typeArgument2), GenericMethodInvokerFactory2);
959-
#else
960-
public static MethodInfo CachedMakeGenericMethodInvoker(this MethodInfo genericDefinition, Type typeArgument) =>
961-
CachedMakeGenericMethod(genericDefinition, typeArgument);
962-
963-
public static MethodInfo CachedMakeGenericMethodInvoker(this MethodInfo genericDefinition, Type typeArgument1, Type typeArgument2) =>
964-
CachedMakeGenericMethod(genericDefinition, typeArgument1, typeArgument2);
965958
#endif
966959

967960
public static Type CachedMakeGenericType(this Type genericDefinition, Type typeArgument) =>

0 commit comments

Comments
 (0)