Skip to content

Commit 49c16f6

Browse files
authored
Convert LinqExtensionRegistration to readonly struct (#418)
* Convert `LinqExtensionRegistration` to readonly struct * Remove redundant ReferenceEquals
1 parent 7865a54 commit 49c16f6

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

Orm/Xtensive.Orm/Orm/Configuration/LinqExtensionRegistration.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,30 @@
44
// Created by: Denis Krjuchkov
55
// Created: 2011.10.27
66

7-
using System;
87
using System.Linq.Expressions;
98
using System.Reflection;
10-
using Xtensive.Core;
11-
129

1310
namespace Xtensive.Orm.Configuration
1411
{
1512
/// <summary>
1613
/// Registration entry for LINQ extension.
1714
/// </summary>
18-
public sealed class LinqExtensionRegistration
15+
public readonly struct LinqExtensionRegistration
1916
{
2017
/// <summary>
2118
/// Gets member this extension is intended for.
2219
/// </summary>
23-
public MemberInfo Member { get; private set; }
20+
public MemberInfo Member { get; }
2421

2522
/// <summary>
2623
/// Gets substitution that is performed when LINQ translator encouters <see cref="Member"/> access.
2724
/// </summary>
28-
public LambdaExpression Substitution { get; private set; }
25+
public LambdaExpression Substitution { get; }
2926

3027
/// <summary>
3128
/// Gets action that is performed when LINQ translator encouters <see cref="Member"/> access.
3229
/// </summary>
33-
public Func<MemberInfo, Expression, Expression[], Expression> Compiler { get; private set; }
30+
public Func<MemberInfo, Expression, Expression[], Expression> Compiler { get; }
3431

3532

3633
// Constructors
@@ -63,4 +60,4 @@ public LinqExtensionRegistration(MemberInfo member, Func<MemberInfo, Expression,
6360
Compiler = compiler;
6461
}
6562
}
66-
}
63+
}

Orm/Xtensive.Orm/Orm/Linq/MemberCompilation/MemberCompilerProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ internal partial class MemberCompilerProvider<T> : LockableBase, IMemberCompiler
2222
private readonly Module module;
2323
private readonly int metadataToken;
2424

25-
public bool Equals(CompilerKey other) => metadataToken == other.metadataToken
26-
&& (ReferenceEquals(module, other.module) || module == other.module);
25+
public bool Equals(CompilerKey other) => metadataToken == other.metadataToken && module == other.module;
2726

2827
public override bool Equals(object obj) => obj is CompilerKey other && Equals(other);
2928

0 commit comments

Comments
 (0)