Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dd71dd8

Browse files
committedMar 3, 2025·
Revert "EntityLockProviderCache"
This reverts commit 85d7c8c.
1 parent ca437e5 commit dd71dd8

File tree

5 files changed

+44
-43
lines changed

5 files changed

+44
-43
lines changed
 

‎Orm/Xtensive.Orm/Orm/Domain.cs

-5
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,6 @@ public static Domain Demand()
150150
/// </summary>
151151
internal ConcurrentDictionary<AssociationInfo, (CompilableProvider, Parameter<Xtensive.Tuples.Tuple>)> RefsToEntityQueryCache { get; } = new();
152152

153-
/// <summary>
154-
/// Caches providers that lock certain type of entity with certain <see cref="LockMode"/> and <see cref="LockBehavior"/>.
155-
/// </summary>
156-
internal ConcurrentDictionary<(TypeInfo, LockMode, LockBehavior), ExecutableProvider> EntityLockProviderCache { get; } = new();
157-
158153
internal object UpgradeContextCookie { get; private set; }
159154

160155
internal SqlConnection SingleConnection { get; private set; }

‎Orm/Xtensive.Orm/Orm/DomainBound.cs

+36-36
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,45 @@
66

77
using Xtensive.Core;
88

9-
namespace Xtensive.Orm
9+
10+
namespace Xtensive.Orm;
11+
12+
/// <summary>
13+
/// Base class for all objects that are bound to the <see cref="Domain"/> instance.
14+
/// </summary>
15+
public abstract class DomainBound: IContextBound<Domain>
1016
{
1117
/// <summary>
12-
/// Base class for all objects that are bound to the <see cref="Domain"/> instance.
18+
/// Gets <see cref="Domain"/> to which current instance is bound.
19+
/// </summary>
20+
public Domain Domain { get; internal set; }
21+
22+
#region IContextBound<Domain> Members
23+
24+
/// <inheritdoc/>
25+
Domain IContextBound<Domain>.Context => Domain;
26+
27+
#endregion
28+
29+
30+
// Constructors
31+
32+
/// <summary>
33+
/// Initializes a new instance of this class.
34+
/// </summary>
35+
protected DomainBound()
36+
{
37+
}
38+
39+
/// <summary>
40+
/// Initializes a new instance of this class.
1341
/// </summary>
14-
public abstract class DomainBound: IContextBound<Domain>
42+
/// <param name="domain"><see cref="Orm.Domain"/>, to which current instance
43+
/// is bound.</param>
44+
/// <exception cref="ArgumentNullException"><paramref name="domain"/> is <see langword="null" />.</exception>
45+
protected DomainBound(Domain domain)
1546
{
16-
/// <summary>
17-
/// Gets <see cref="Domain"/> to which current instance is bound.
18-
/// </summary>
19-
public Domain Domain { get; internal set; }
20-
21-
#region IContextBound<Domain> Members
22-
23-
/// <inheritdoc/>
24-
Domain IContextBound<Domain>.Context => Domain;
25-
26-
#endregion
27-
28-
29-
// Constructors
30-
31-
/// <summary>
32-
/// Initializes a new instance of this class.
33-
/// </summary>
34-
protected DomainBound()
35-
{
36-
}
37-
38-
/// <summary>
39-
/// Initializes a new instance of this class.
40-
/// </summary>
41-
/// <param name="domain"><see cref="Orm.Domain"/>, to which current instance
42-
/// is bound.</param>
43-
/// <exception cref="ArgumentNullException"><paramref name="domain"/> is <see langword="null" />.</exception>
44-
protected DomainBound(Domain domain)
45-
{
46-
ArgumentNullException.ThrowIfNull(domain);
47-
Domain = domain;
48-
}
47+
ArgumentNullException.ThrowIfNull(domain);
48+
Domain = domain;
4949
}
5050
}

‎Orm/Xtensive.Orm/Orm/Entity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public void Lock(LockMode lockMode, LockBehavior lockBehavior)
270270
{
271271
var parameterContext = new ParameterContext();
272272
parameterContext.SetValue(keyParameter, Key.Value);
273-
var source = Session.Domain.EntityLockProviderCache.GetOrAdd((TypeInfo, lockMode, lockBehavior), ExecutableProviderGenerator, Session);
273+
var source = Session.StorageNode.EntityLockProviderCache.GetOrAdd((TypeInfo, lockMode, lockBehavior), ExecutableProviderGenerator, Session);
274274
using var recordSetReader = source.GetRecordSetReader(Session, parameterContext);
275275
recordSetReader.MoveNext();
276276
}

‎Orm/Xtensive.Orm/Orm/Providers/SessionHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public abstract partial class SessionHandler : IDisposable, IAsyncDisposable
2727
/// <summary>
2828
/// Gets the current <see cref="Session"/>.
2929
/// </summary>
30-
public Session Session { get; }
30+
public Session Session { get; private set; }
3131

3232
/// <summary>
3333
/// Gets the real session handler (the final handler in chain of all <see cref="ChainingSessionHandler"/>s).

‎Orm/Xtensive.Orm/Orm/StorageNode.cs

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ public sealed class StorageNode : ISessionSource
4444
/// </summary>
4545
public TypeIdRegistry TypeIdRegistry { get; private set; }
4646

47+
/// <summary>
48+
/// Caches providers that lock certain type of entity with certain <see cref="LockMode"/> and <see cref="LockBehavior"/>.
49+
/// </summary>
50+
internal ConcurrentDictionary<(TypeInfo, LockMode, LockBehavior), ExecutableProvider> EntityLockProviderCache { get; } = new();
51+
52+
4753
/// <summary>
4854
/// Caches certain info about EntitySet fields, e.g. queries to fetch current count or items.
4955
/// </summary>

0 commit comments

Comments
 (0)
Please sign in to comment.