File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Orm/Xtensive.Orm/Orm/Model Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
- // Copyright (C) 2007-2021 Xtensive LLC.
1
+ // Copyright (C) 2007-2022 Xtensive LLC.
2
2
// This code is distributed under MIT license terms.
3
3
// See the License.txt file in the project root for more information.
4
4
// Created by: Dmitri Maximov
@@ -627,6 +627,7 @@ public ColumnInfoCollection Columns
627
627
628
628
var result = new ColumnInfoCollection ( this , "Columns" ) ;
629
629
GetColumns ( result ) ;
630
+ columns = result ;
630
631
return result ;
631
632
}
632
633
}
@@ -660,8 +661,8 @@ public override void UpdateState()
660
661
Fields . UpdateState ( ) ;
661
662
if ( column != null )
662
663
column . UpdateState ( ) ;
663
- columns = new ColumnInfoCollection ( this , "Columns" ) ;
664
- GetColumns ( columns ) ;
664
+ columns ? . Clear ( ) ; // To prevent event handler leak
665
+ columns = null ;
665
666
666
667
HasImmediateValidators = validators . Count > 0 && validators . Any ( v => v . IsImmediate ) ;
667
668
Original file line number Diff line number Diff line change 1
- // Copyright (C) 2007-2020 Xtensive LLC.
1
+ // Copyright (C) 2007-2022 Xtensive LLC.
2
2
// This code is distributed under MIT license terms.
3
3
// See the License.txt file in the project root for more information.
4
4
// Created by: Dmitri Maximov
@@ -38,7 +38,7 @@ public sealed class TypeInfo : SchemaMappedNode
38
38
/// </summary>
39
39
public const int MinTypeId = 100 ;
40
40
41
- private ColumnInfoCollection columns ;
41
+ private readonly ColumnInfoCollection columns ;
42
42
private readonly FieldMap fieldMap ;
43
43
private readonly FieldInfoCollection fields ;
44
44
private readonly TypeIndexInfoCollection indexes ;
@@ -747,8 +747,8 @@ private bool GetIsLeaf()
747
747
748
748
private void CreateTupleDescriptor ( )
749
749
{
750
- var orderedColumns = columns . OrderBy ( c => c . Field . MappingInfo . Offset ) ;
751
- columns = new ColumnInfoCollection ( this , "Columns" ) ;
750
+ var orderedColumns = columns . OrderBy ( c => c . Field . MappingInfo . Offset ) . ToList ( columns . Count ) ;
751
+ columns . Clear ( ) ; // To prevent event handler leak
752
752
columns . AddRange ( orderedColumns ) ;
753
753
TupleDescriptor = TupleDescriptor . Create (
754
754
Columns . Select ( c => c . ValueType ) . ToArray ( Columns . Count ) ) ;
You can’t perform that action at this time.
0 commit comments