Skip to content

Commit c096fb6

Browse files
committed
Copyright and formatting update
1 parent 4e9225e commit c096fb6

File tree

4 files changed

+30
-39
lines changed

4 files changed

+30
-39
lines changed

Orm/Xtensive.Orm/Orm/Internals/ChangeRegistries/EntityChangeRegistry.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2008-2020 Xtensive LLC.
1+
// Copyright (C) 2008-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: Dmitri Maximov
@@ -15,9 +15,9 @@ namespace Xtensive.Orm.Internals
1515
/// </summary>
1616
public sealed class EntityChangeRegistry : SessionBound
1717
{
18-
private readonly HashSet<EntityState> @new = new HashSet<EntityState>();
19-
private readonly HashSet<EntityState> modified = new HashSet<EntityState>();
20-
private readonly HashSet<EntityState> removed = new HashSet<EntityState>();
18+
private readonly HashSet<EntityState> @new = new();
19+
private readonly HashSet<EntityState> modified = new();
20+
private readonly HashSet<EntityState> removed = new();
2121

2222
/// <summary>
2323
/// Gets the number of registered entities.
@@ -32,7 +32,7 @@ internal void Register(EntityState item)
3232
{
3333
// Remove-create sequences fix for Issue 690
3434
if (item.PersistenceState == PersistenceState.New && removed.Contains(item)) {
35-
removed.Remove(item);
35+
_ = removed.Remove(item);
3636
Count--;
3737
if (item.DifferentialTuple.Difference == null) {
3838
item.SetPersistenceState(PersistenceState.Synchronized);
@@ -41,18 +41,19 @@ internal void Register(EntityState item)
4141
item.SetPersistenceState(PersistenceState.Modified);
4242
}
4343
else if (item.PersistenceState == PersistenceState.Removed && @new.Contains(item)) {
44-
@new.Remove(item);
44+
_ = @new.Remove(item);
4545
Count--;
4646
return;
4747
}
4848
else if (item.PersistenceState == PersistenceState.Removed && modified.Contains(item)) {
49-
modified.Remove(item);
49+
_ = modified.Remove(item);
5050
Count--;
5151
}
5252

5353
var container = GetContainer(item.PersistenceState);
54-
if (container.Add(item))
54+
if (container.Add(item)) {
5555
Count++;
56+
}
5657
}
5758

5859
/// <summary>
@@ -61,7 +62,7 @@ internal void Register(EntityState item)
6162
/// <param name="state">The state of items to get.</param>
6263
/// <returns>The sequence of items with specified state.</returns>
6364
public RegistryItems<EntityState> GetItems(in PersistenceState state) =>
64-
new RegistryItems<EntityState>(GetContainer(state));
65+
new(GetContainer(state));
6566

6667
/// <summary>
6768
/// Clears the registry.
@@ -81,7 +82,7 @@ private HashSet<EntityState> GetContainer(in PersistenceState state)
8182
PersistenceState.New => @new,
8283
PersistenceState.Modified => modified,
8384
PersistenceState.Removed => removed,
84-
_ => throw new ArgumentOutOfRangeException("state"),
85+
_ => throw new ArgumentOutOfRangeException(nameof(state)),
8586
};
8687
}
8788

Orm/Xtensive.Orm/Orm/Internals/ChangeRegistries/EntitySetChangeRegistry.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2014 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2014-2022 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexey Kulakov
55
// Created: 2014.03.27
66

@@ -13,7 +13,7 @@ namespace Xtensive.Orm.Internals
1313
/// </summary>
1414
public sealed class EntitySetChangeRegistry : SessionBound
1515
{
16-
private readonly HashSet<EntitySetState> modifiedEntitySets = new HashSet<EntitySetState>();
16+
private readonly HashSet<EntitySetState> modifiedEntitySets = new();
1717

1818
/// <summary>
1919
/// Count of registered <see cref="EntitySetState"/>.
@@ -24,22 +24,18 @@ public sealed class EntitySetChangeRegistry : SessionBound
2424
/// Register the specified <see cref="EntitySetState"/>.
2525
/// </summary>
2626
/// <param name="entitySetState"><see cref="EntitySetState"/> to bound.</param>
27-
public void Register(EntitySetState entitySetState)
28-
{
29-
modifiedEntitySets.Add(entitySetState);
30-
}
27+
public void Register(EntitySetState entitySetState) => modifiedEntitySets.Add(entitySetState);
3128

3229
/// <summary>
3330
/// Gets all registered items.
3431
/// </summary>
3532
/// <returns></returns>
36-
public RegistryItems<EntitySetState> GetItems() =>
37-
new RegistryItems<EntitySetState>(modifiedEntitySets);
33+
public RegistryItems<EntitySetState> GetItems() => new(modifiedEntitySets);
3834

39-
public void Clear()
40-
{
41-
modifiedEntitySets.Clear();
42-
}
35+
/// <summary>
36+
/// Clears the registry.
37+
/// </summary>
38+
public void Clear() => modifiedEntitySets.Clear();
4339

4440
/// <summary>
4541
/// Initializes a new instance of this class.

Orm/Xtensive.Orm/Orm/Internals/ChangeRegistries/ReferenceFieldChangeInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2014 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2014-2022 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexey Kulakov
55
// Created: 2014.04.07
66

Orm/Xtensive.Orm/Orm/Internals/ChangeRegistries/ReferenceFieldsChangesRegistry.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2014 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2014-2022 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexey Kulakov
55
// Created: 2014.04.07
66

@@ -15,7 +15,7 @@ namespace Xtensive.Orm.Internals
1515
/// </summary>
1616
internal sealed class ReferenceFieldsChangesRegistry : SessionBound
1717
{
18-
private readonly HashSet<ReferenceFieldChangeInfo> changes = new HashSet<ReferenceFieldChangeInfo>();
18+
private readonly HashSet<ReferenceFieldChangeInfo> changes = new ();
1919

2020
/// <summary>
2121
/// Registrates information about field which value was set.
@@ -56,15 +56,9 @@ public void Register(Key fieldOwner, Key fieldValue, Key auxiliaryEntity, FieldI
5656
/// <summary>
5757
/// Removes all registered items.
5858
/// </summary>
59-
public void Clear()
60-
{
61-
changes.Clear();
62-
}
59+
public void Clear() => changes.Clear();
6360

64-
private void Register(ReferenceFieldChangeInfo fieldChangeInfo)
65-
{
66-
changes.Add(fieldChangeInfo);
67-
}
61+
private void Register(ReferenceFieldChangeInfo fieldChangeInfo) => changes.Add(fieldChangeInfo);
6862

6963
public ReferenceFieldsChangesRegistry(Session session)
7064
: base(session)

0 commit comments

Comments
 (0)