Skip to content

Commit 8b6c796

Browse files
committed
Merge branch 'master' into master-indexinfo-imp
# Conflicts: # Orm/Xtensive.Orm/Orm/Building/Builders/IndexBuilder.cs # Orm/Xtensive.Orm/Orm/Model/IndexInfo.cs
2 parents d6f015f + 797fc69 commit 8b6c796

4 files changed

Lines changed: 98 additions & 110 deletions

File tree

Orm/Xtensive.Orm/Orm/Building/Builders/IndexBuilder.ConcreteTable.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private void BuildConcreteTableIndexes(TypeInfo type)
3434
continue;
3535
}
3636

37-
var declaredIndex = BuildIndex(type, indexDescriptor, type.IsAbstract);
37+
var declaredIndex = BuildIndex(type, indexDescriptor, type.IsAbstract);
3838
type.Indexes.Add(declaredIndex);
3939
if (!declaredIndex.IsAbstract) {
4040
context.Model.RealIndexes.Add(declaredIndex);
@@ -46,7 +46,7 @@ private void BuildConcreteTableIndexes(TypeInfo type)
4646
if (parent != null) {
4747
var parentPrimaryIndex = parent.Indexes.FindFirst(IndexAttributes.Primary | IndexAttributes.Real);
4848
var inheritedIndex = BuildInheritedIndex(type, parentPrimaryIndex, type.IsAbstract);
49-
49+
5050
// Registering built primary index
5151
type.Indexes.Add(inheritedIndex);
5252
if (!inheritedIndex.IsAbstract) {
@@ -63,6 +63,7 @@ private void BuildConcreteTableIndexes(TypeInfo type)
6363

6464
var index = BuildInheritedIndex(type, parentIndex, type.IsAbstract);
6565
if ((parent != null && parent.Indexes.Contains(index.Name)) || type.Indexes.Contains(index.Name)) {
66+
index.Dispose();
6667
continue;
6768
}
6869

Orm/Xtensive.Orm/Orm/Building/Builders/IndexBuilder.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private void CreateInterfaceIndexes(TypeInfo @interface, ICollection<TypeInfo> p
9292
foreach (var parentIndex in parent.Indexes.Find(IndexAttributes.Primary, MatchType.None).ToChainedBuffer()) {
9393
var index = BuildInheritedIndex(@interface, parentIndex, false);
9494
if (@interface.Indexes.Contains(index.Name)) {
95+
index.Dispose();
9596
continue;
9697
}
9798

@@ -201,8 +202,10 @@ private void BuildInterfaceIndexes()
201202
}
202203
underlyingIndexes.Add(underlyingIndex);
203204
}
204-
if (underlyingIndexes.Count == 1)
205+
if (underlyingIndexes.Count == 1) {
206+
index.Dispose();
205207
index = underlyingIndexes.First();
208+
}
206209
else
207210
index.UnderlyingIndexes.AddRange(underlyingIndexes);
208211

Orm/Xtensive.Orm/Orm/Model/FieldInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ public override void Lock(bool recursive)
675675
column.Lock(true);
676676
if (associations.Count > 1) {
677677
var sorted = associations.Reorder();
678+
associations.Clear();
678679
associations = new NodeCollection<AssociationInfo>(associations.Owner, associations.Name);
679680
associations.AddRange(sorted);
680681
}

0 commit comments

Comments
 (0)