Skip to content

Commit 45e6ace

Browse files
committed
Use ImmutableArray<T> instead of ReadOnlyMemory<T>
1 parent 94848cf commit 45e6ace

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/libs/QLimitive/Commands/Insert.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal readonly struct Insert<T>(DbDialect dialect, bool useAmbientValue)
2424
public void Build(ref DefaultInterpolatedStringHandler handler, ref BindParameterCollection? parameters)
2525
{
2626
var table = TableMappingInfo.Get<T>();
27-
var columns = table.Columns.Span;
27+
var columns = table.Columns.AsSpan();
2828
var bracket = this._dialect.KeywordBracket;
2929
var prefix = this._dialect.BindParameterPrefix;
3030

src/libs/QLimitive/Commands/Select.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void Build(ref DefaultInterpolatedStringHandler handler, ref BindParamete
3333

3434
//--- Build SQL
3535
var table = TableMappingInfo.Get<T>();
36-
var columns = table.Columns.Span;
36+
var columns = table.Columns.AsSpan();
3737
var bracket = this._dialect.KeywordBracket;
3838
handler.Append("select");
3939
foreach (var x in columns)

src/libs/QLimitive/Commands/Update.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void Build(ref DefaultInterpolatedStringHandler handler, ref BindParamete
3434

3535
//--- Build SQL
3636
var table = TableMappingInfo.Get<T>();
37-
var columns = table.Columns.Span;
37+
var columns = table.Columns.AsSpan();
3838
var bracket = this._dialect.KeywordBracket;
3939
var prefix = this._dialect.BindParameterPrefix;
4040

src/libs/QLimitive/Mappings/TableMappingInfo.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Frozen;
33
using System.Collections.Generic;
4+
using System.Collections.Immutable;
45
using System.ComponentModel.DataAnnotations;
56
using System.ComponentModel.DataAnnotations.Schema;
67
using System.Linq;
@@ -38,7 +39,7 @@ public sealed class TableMappingInfo
3839
/// <summary>
3940
/// Gets the column mapping information.
4041
/// </summary>
41-
public ReadOnlyMemory<ColumnMappingInfo> Columns { get; }
42+
public ImmutableArray<ColumnMappingInfo> Columns { get; }
4243

4344

4445
/// <summary>
@@ -56,7 +57,7 @@ public sealed class TableMappingInfo
5657
/// <param name="type"></param>
5758
/// <param name="table"></param>
5859
/// <param name="columns"></param>
59-
private TableMappingInfo(Type type, TableAttribute? table, ColumnMappingInfo[] columns)
60+
private TableMappingInfo(Type type, TableAttribute? table, ImmutableArray<ColumnMappingInfo> columns)
6061
{
6162
this.Type = type;
6263
this.Schema = table?.Schema;
@@ -99,7 +100,7 @@ static Cache()
99100
{
100101
var type = typeof(T);
101102
var table = type.GetCustomAttributes<TableAttribute>(true).FirstOrDefault();
102-
var columns = getColumns().ToArray();
103+
var columns = getColumns().ToImmutableArray();
103104
Instance = new(type, table, columns);
104105

105106
#region Local Functions

0 commit comments

Comments
 (0)