From 856debdfeac7f305fe5c73c04a9ff114598378f8 Mon Sep 17 00:00:00 2001 From: Sergei Pavlov Date: Fri, 7 Mar 2025 18:44:25 -0800 Subject: [PATCH] Make `RecordSetHeader.ColumnGroups` array instead of List<> --- Orm/Xtensive.Orm/Orm/Model/ColumnGroup.cs | 58 +++++---------------- Orm/Xtensive.Orm/Orm/Rse/RecordSetHeader.cs | 2 +- 2 files changed, 14 insertions(+), 46 deletions(-) diff --git a/Orm/Xtensive.Orm/Orm/Model/ColumnGroup.cs b/Orm/Xtensive.Orm/Orm/Model/ColumnGroup.cs index 35367fada5..d37ab11136 100644 --- a/Orm/Xtensive.Orm/Orm/Model/ColumnGroup.cs +++ b/Orm/Xtensive.Orm/Orm/Model/ColumnGroup.cs @@ -4,51 +4,19 @@ // Created by: Alexey Kochetov // Created: 2008.08.01 -using System; -using System.Collections.Generic; using System.Diagnostics; using Xtensive.Collections; - -namespace Xtensive.Orm.Model -{ - /// - /// Describes a group of columns that belongs to the specified . - /// - [Serializable] - [DebuggerDisplay("Type = {TypeInfoRef}, Keys = {Keys}, Columns = {Columns}")] - public readonly struct ColumnGroup - { - /// - /// Gets the pointing to - /// this column group belongs to. - /// - public TypeInfoRef TypeInfoRef { get; } - - /// - /// Gets the indexes of key columns. - /// - public IReadOnlyList Keys { get; } - - /// - /// Gets the indexes of all columns. - /// - public IReadOnlyList Columns { get; } - - - // Constructors - - /// - /// Initializes a new instance of this class. - /// - /// The type. - /// The keys. - /// The columns. - public ColumnGroup(TypeInfoRef type, IReadOnlyList keys, IReadOnlyList columns) - { - TypeInfoRef = type; - Keys = keys; - Columns = columns; - } - } -} \ No newline at end of file +namespace Xtensive.Orm.Model; + +/// +/// Describes a group of columns that belongs to the specified . +/// +[Serializable] +[DebuggerDisplay("Type = {TypeInfoRef}, Keys = {Keys}, Columns = {Columns}")] +public record struct ColumnGroup +( + TypeInfoRef TypeInfoRef, + IReadOnlyList Keys, // indexes of key columns. + IReadOnlyList Columns // indexes of all columns. +); diff --git a/Orm/Xtensive.Orm/Orm/Rse/RecordSetHeader.cs b/Orm/Xtensive.Orm/Orm/Rse/RecordSetHeader.cs index 5b9ce05364..5549e3139e 100644 --- a/Orm/Xtensive.Orm/Orm/Rse/RecordSetHeader.cs +++ b/Orm/Xtensive.Orm/Orm/Rse/RecordSetHeader.cs @@ -188,7 +188,7 @@ public RecordSetHeader Select(IReadOnlyList columns) return new RecordSetHeader( TupleDescriptor.CreateFromNormalized(columns.Select(i => TupleDescriptor[i]).ToArray(columns.Count)), columns.Select((oldIndex, newIndex) => Columns[oldIndex].Clone((ColNum) newIndex)).ToArray(columns.Count), - resultGroups.ToList(), + resultGroups.ToArray(), null, resultOrder); }