Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RecordSetHeader.ColumnGroups array instead of List<> #364

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 13 additions & 45 deletions Orm/Xtensive.Orm/Orm/Model/ColumnGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
/// Describes a group of columns that belongs to the specified <see cref="TypeInfoRef"/>.
/// </summary>
[Serializable]
[DebuggerDisplay("Type = {TypeInfoRef}, Keys = {Keys}, Columns = {Columns}")]
public readonly struct ColumnGroup
{
/// <summary>
/// Gets the <see cref="Model.TypeInfoRef"/> pointing to <see cref="TypeInfo"/>
/// this column group belongs to.
/// </summary>
public TypeInfoRef TypeInfoRef { get; }

/// <summary>
/// Gets the indexes of key columns.
/// </summary>
public IReadOnlyList<ColNum> Keys { get; }

/// <summary>
/// Gets the indexes of all columns.
/// </summary>
public IReadOnlyList<ColNum> Columns { get; }


// Constructors

/// <summary>
/// Initializes a new instance of this class.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="keys">The keys.</param>
/// <param name="columns">The columns.</param>
public ColumnGroup(TypeInfoRef type, IReadOnlyList<ColNum> keys, IReadOnlyList<ColNum> columns)
{
TypeInfoRef = type;
Keys = keys;
Columns = columns;
}
}
}
namespace Xtensive.Orm.Model;

/// <summary>
/// Describes a group of columns that belongs to the specified <see cref="TypeInfoRef"/>.
/// </summary>
[Serializable]
[DebuggerDisplay("Type = {TypeInfoRef}, Keys = {Keys}, Columns = {Columns}")]
public record struct ColumnGroup
(
TypeInfoRef TypeInfoRef,
IReadOnlyList<ColNum> Keys, // indexes of key columns.
IReadOnlyList<ColNum> Columns // indexes of all columns.
);
2 changes: 1 addition & 1 deletion Orm/Xtensive.Orm/Orm/Rse/RecordSetHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public RecordSetHeader Select(IReadOnlyList<ColNum> 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);
}
Expand Down