@@ -15,11 +15,11 @@ internal sealed class ResourceChangeDetector
15
15
private readonly CollectionConverter _collectionConverter = new ( ) ;
16
16
private readonly IDataModelService _dataModelService ;
17
17
18
- private Dictionary < string , object ? > _currentColumnValues = new ( ) ;
19
- private Dictionary < string , object ? > _newColumnValues = new ( ) ;
18
+ private Dictionary < string , object ? > _currentColumnValues = [ ] ;
19
+ private Dictionary < string , object ? > _newColumnValues = [ ] ;
20
20
21
- private Dictionary < RelationshipAttribute , ISet < IIdentifiable > > _currentRightResourcesByRelationship = new ( ) ;
22
- private Dictionary < RelationshipAttribute , ISet < IIdentifiable > > _newRightResourcesByRelationship = new ( ) ;
21
+ private Dictionary < RelationshipAttribute , ISet < IIdentifiable > > _currentRightResourcesByRelationship = [ ] ;
22
+ private Dictionary < RelationshipAttribute , ISet < IIdentifiable > > _newRightResourcesByRelationship = [ ] ;
23
23
24
24
public ResourceType ResourceType { get ; }
25
25
@@ -52,7 +52,7 @@ public void CaptureNewValues(IIdentifiable resource)
52
52
53
53
private Dictionary < string , object ? > CaptureColumnValues ( IIdentifiable resource )
54
54
{
55
- Dictionary < string , object ? > columnValues = new ( ) ;
55
+ Dictionary < string , object ? > columnValues = [ ] ;
56
56
57
57
foreach ( ( string columnName , ResourceFieldAttribute ? _ ) in _dataModelService . GetColumnMappings ( ResourceType ) )
58
58
{
@@ -64,7 +64,7 @@ public void CaptureNewValues(IIdentifiable resource)
64
64
65
65
private Dictionary < RelationshipAttribute , ISet < IIdentifiable > > CaptureRightResourcesByRelationship ( IIdentifiable resource )
66
66
{
67
- Dictionary < RelationshipAttribute , ISet < IIdentifiable > > relationshipValues = new ( ) ;
67
+ Dictionary < RelationshipAttribute , ISet < IIdentifiable > > relationshipValues = [ ] ;
68
68
69
69
foreach ( RelationshipAttribute relationship in ResourceType . Relationships )
70
70
{
@@ -107,7 +107,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
107
107
108
108
public IReadOnlyDictionary < HasOneAttribute , ( object ? currentRightId , object newRightId ) > GetOneToOneRelationshipsChangedToNotNull ( )
109
109
{
110
- Dictionary < HasOneAttribute , ( object ? currentRightId , object newRightId ) > changes = new ( ) ;
110
+ Dictionary < HasOneAttribute , ( object ? currentRightId , object newRightId ) > changes = [ ] ;
111
111
112
112
foreach ( ( RelationshipAttribute relationship , ISet < IIdentifiable > newRightResources ) in _newRightResourcesByRelationship )
113
113
{
@@ -135,7 +135,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
135
135
136
136
public IReadOnlyDictionary < string , object ? > GetChangedColumnValues ( )
137
137
{
138
- Dictionary < string , object ? > changes = new ( ) ;
138
+ Dictionary < string , object ? > changes = [ ] ;
139
139
140
140
foreach ( ( string columnName , object ? newColumnValue ) in _newColumnValues )
141
141
{
@@ -152,7 +152,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
152
152
153
153
public IReadOnlyDictionary < HasOneAttribute , ( object ? currentRightId , object ? newRightId ) > GetChangedToOneRelationshipsWithForeignKeyAtRightSide ( )
154
154
{
155
- Dictionary < HasOneAttribute , ( object ? currentRightId , object ? newRightId ) > changes = new ( ) ;
155
+ Dictionary < HasOneAttribute , ( object ? currentRightId , object ? newRightId ) > changes = [ ] ;
156
156
157
157
foreach ( ( RelationshipAttribute relationship , ISet < IIdentifiable > newRightResources ) in _newRightResourcesByRelationship )
158
158
{
@@ -183,7 +183,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
183
183
184
184
public IReadOnlyDictionary < HasManyAttribute , ( ISet < object > currentRightIds , ISet < object > newRightIds ) > GetChangedToManyRelationships ( )
185
185
{
186
- Dictionary < HasManyAttribute , ( ISet < object > currentRightIds , ISet < object > newRightIds ) > changes = new ( ) ;
186
+ Dictionary < HasManyAttribute , ( ISet < object > currentRightIds , ISet < object > newRightIds ) > changes = [ ] ;
187
187
188
188
foreach ( ( RelationshipAttribute relationship , ISet < IIdentifiable > newRightResources ) in _newRightResourcesByRelationship )
189
189
{
@@ -194,7 +194,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
194
194
HashSet < object > currentRightIds =
195
195
_currentRightResourcesByRelationship . TryGetValue ( hasManyRelationship , out ISet < IIdentifiable > ? currentRightResources )
196
196
? currentRightResources . Select ( resource => resource . GetTypedId ( ) ) . ToHashSet ( )
197
- : new HashSet < object > ( ) ;
197
+ : [ ] ;
198
198
199
199
if ( ! currentRightIds . SetEquals ( newRightIds ) )
200
200
{
0 commit comments