Skip to content

Commit 564efa2

Browse files
committed
Code formatting [skip ci]
1 parent d6b0500 commit 564efa2

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/Sql/ConnectionExtensions.Async.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ public static async Task<IEnumerable<ExpandoObject>> QueryAsync(this IDbConnecti
164164
/// <param name="options">The query options.</param>
165165
/// <param name="cancellationToken">The token to cancel the operation.</param>
166166
/// <returns>The sequence of object pairs whose properties correspond to the columns.</returns>
167-
public static async Task<IEnumerable<(T, U)>> QueryAsync<T, U>(this IDbConnection connection, string text, ParameterCollection? parameters = null, string splitOn = "Id", QueryOptions? options = null, CancellationToken cancellationToken = default) where T: new() where U: new() {
168-
var records = Mapper.Instance.CreateInstances<T, U>(await ExecuteReaderAsync(connection, text, parameters, options, cancellationToken), splitOn);
167+
public static async Task<IEnumerable<(TItem1, TItem2)>> QueryAsync<TItem1, TItem2>(this IDbConnection connection, string text, ParameterCollection? parameters = null, string splitOn = "Id", QueryOptions? options = null, CancellationToken cancellationToken = default) where TItem1: new() where TItem2: new() {
168+
var records = Mapper.Instance.CreateInstances<TItem1, TItem2>(await ExecuteReaderAsync(connection, text, parameters, options, cancellationToken), splitOn);
169169
return (options?.Buffered ?? true) ? Enumerable.ToList(records) : records;
170170
}
171171

src/Sql/ConnectionExtensions.Sync.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ public static IEnumerable<ExpandoObject> Query(this IDbConnection connection, st
156156
/// <param name="splitOn">The field from which to split and read the second object.</param>
157157
/// <param name="options">The query options.</param>
158158
/// <returns>The sequence of object pairs whose properties correspond to the columns.</returns>
159-
public static IEnumerable<(T, U)> Query<T, U>(this IDbConnection connection, string text, ParameterCollection? parameters = null, string splitOn = "Id", QueryOptions? options = null) where T: new() where U: new() {
160-
var records = Mapper.Instance.CreateInstances<T, U>(ExecuteReader(connection, text, parameters, options), splitOn);
159+
public static IEnumerable<(TItem1, TItem2)> Query<TItem1, TItem2>(this IDbConnection connection, string text, ParameterCollection? parameters = null, string splitOn = "Id", QueryOptions? options = null) where TItem1: new() where TItem2: new() {
160+
var records = Mapper.Instance.CreateInstances<TItem1, TItem2>(ExecuteReader(connection, text, parameters, options), splitOn);
161161
return (options?.Buffered ?? true) ? Enumerable.ToList(records) : records;
162162
}
163163

src/Sql/Mapper.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private Mapper() {}
5858
/// <param name="splitOn">The field from which to split and read the second object.</param>
5959
/// <returns>The newly created object pair.</returns>
6060
/// <exception cref="InvalidOperationException">The split field could not be found.</exception>
61-
public (T, U) CreateInstance<T, U>(IDataRecord record, string splitOn = "Id") where T: new() where U: new() {
61+
public (TItem1, TItem2) CreateInstance<TItem1, TItem2>(IDataRecord record, string splitOn = "Id") where TItem1: new() where TItem2: new() {
6262
var properties = new List<KeyValuePair<string, object?>>(record.FieldCount);
6363
for (var index = 0; index < record.FieldCount; index++) {
6464
var value = record[index];
@@ -71,8 +71,8 @@ private Mapper() {}
7171
var firstObject = properties.Take(splitOnIndex).ToDictionary();
7272
var secondObject = properties.Skip(splitOnIndex).ToDictionary();
7373
return (
74-
firstObject.Values.All(value => value is null) ? default! : CreateInstance<T>(firstObject),
75-
secondObject.Values.All(value => value is null) ? default! : CreateInstance<U>(secondObject)
74+
firstObject.Values.All(value => value is null) ? default! : CreateInstance<TItem1>(firstObject),
75+
secondObject.Values.All(value => value is null) ? default! : CreateInstance<TItem2>(secondObject)
7676
);
7777
}
7878

@@ -132,8 +132,8 @@ private Mapper() {}
132132
/// <param name="reader">A data reader providing the properties to be set on the created objects.</param>
133133
/// <param name="splitOn">The field from which to split and read the second object.</param>
134134
/// <returns>An enumerable of newly created object pairs.</returns>
135-
public IEnumerable<(T, U)> CreateInstances<T, U>(IDataReader reader, string splitOn = "Id") where T: new() where U: new() {
136-
while (reader.Read()) yield return CreateInstance<T, U>(reader, splitOn);
135+
public IEnumerable<(TItem1, TItem2)> CreateInstances<TItem1, TItem2>(IDataReader reader, string splitOn = "Id") where TItem1: new() where TItem2: new() {
136+
while (reader.Read()) yield return CreateInstance<TItem1, TItem2>(reader, splitOn);
137137
reader.Close();
138138
}
139139

0 commit comments

Comments
 (0)