Skip to content

Commit 2aa6cc8

Browse files
committed
Rollback QueryEventArgs to class
1 parent 5e4bb26 commit 2aa6cc8

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Orm/Xtensive.Orm/Orm/QueryEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ namespace Xtensive.Orm
1111
/// Event args for <see cref="SessionEventAccessor.QueryExecuting"/>
1212
/// and <see cref="SessionEventAccessor.QueryExecuted"/>.
1313
/// </summary>
14-
public readonly struct QueryEventArgs
14+
public class QueryEventArgs : EventArgs
1515
{
1616
/// <summary>
1717
/// Gets executed expression.
1818
/// </summary>
19-
public Expression Expression { get; }
19+
public Expression Expression { get; set; }
2020

2121
/// <summary>
2222
/// Gets exception, thrown during expression execution. <see langword="null" /> if expression executed successfully.

Orm/Xtensive.Orm/Orm/SessionEventAccessor.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2010-2020 Xtensive LLC.
1+
// Copyright (C) 2010-2022 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44
// Created by: Alex Yakunin
@@ -256,22 +256,18 @@ internal void NotifyDbCommandExecuted(DbCommand command, Exception exception = n
256256
internal Expression NotifyQueryExecuting(Expression expression)
257257
{
258258
var args = new QueryEventArgs(expression);
259-
if (QueryExecuting!=null) {
260-
QueryExecuting(this, args);
261-
}
259+
QueryExecuting?.Invoke(this, args);
262260
return args.Expression;
263261
}
264262

265263
internal void NotifyQueryExecuted(Expression expression, Exception exception = null)
266264
{
267-
if (QueryExecuted!=null)
268-
QueryExecuted(this, new QueryEventArgs(expression, exception));
265+
QueryExecuted?.Invoke(this, new QueryEventArgs(expression, exception));
269266
}
270267

271268
internal void NotifyDisposing()
272269
{
273-
if (Disposing!=null)
274-
Disposing(this, EventArgs.Empty);
270+
Disposing?.Invoke(this, EventArgs.Empty);
275271
}
276272

277273
internal void NotifyPersisting()
@@ -509,4 +505,4 @@ internal SessionEventAccessor(Session session, bool systemEvents)
509505
SystemEvents = systemEvents;
510506
}
511507
}
512-
}
508+
}

0 commit comments

Comments
 (0)