Skip to content

Commit 8821cac

Browse files
committed
loosen the type signature.
1 parent 72c1995 commit 8821cac

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

SQLitePCL.pretty.Orm/DatabaseConnection.InsertOrReplace.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public static IStatement PrepareInsertOrReplaceStatement(this IDatabaseConnectio
2727
return This.PrepareStatement(tableMapping.InsertOrReplace());
2828
}
2929

30-
private static IEnumerable<KeyValuePair<T,T>> YieldInsertOrReplaceAll<T>(
30+
private static IEnumerable<KeyValuePair<TInserted, TResult>> YieldInsertOrReplaceAll<TInserted, TResult>(
3131
this IDatabaseConnection This,
3232
TableMapping tableMapping,
33-
IEnumerable<T> objects,
34-
Func<IReadOnlyList<IResultSetValue>,T> resultSelector)
33+
IEnumerable<TInserted> objects,
34+
Func<IReadOnlyList<IResultSetValue>,TResult> resultSelector)
3535
{
3636
using (var insertOrReplaceStmt = This.PrepareInsertOrReplaceStatement(tableMapping))
3737
using (var findStmt = This.PrepareFindByRowId(tableMapping.TableName))
@@ -40,7 +40,7 @@ private static IEnumerable<KeyValuePair<T,T>> YieldInsertOrReplaceAll<T>(
4040
{
4141
insertOrReplaceStmt.ExecuteWithProperties(obj);
4242
var rowId = This.LastInsertedRowId;
43-
yield return new KeyValuePair<T,T>(obj, findStmt.Query(rowId).Select(resultSelector).First());
43+
yield return new KeyValuePair<TInserted, TResult>(obj, findStmt.Query(rowId).Select(resultSelector).First());
4444
}
4545
}
4646
}
@@ -53,18 +53,18 @@ private static IEnumerable<KeyValuePair<T,T>> YieldInsertOrReplaceAll<T>(
5353
/// <param name="tableMapping">The table mapping.</param>
5454
/// <param name="obj">The object to insert.</param>
5555
/// <typeparam name="T">The mapped type.</typeparam>
56-
public static T InsertOrReplace<T>(
56+
public static TResult InsertOrReplace<TInserted, TResult>(
5757
this IDatabaseConnection This,
5858
TableMapping tableMapping,
59-
T obj,
60-
Func<IReadOnlyList<IResultSetValue>,T> resultSelector)
59+
TInserted obj,
60+
Func<IReadOnlyList<IResultSetValue>,TResult> resultSelector)
6161
{
6262
Contract.Requires(This != null);
6363
Contract.Requires(tableMapping != null);
6464
Contract.Requires(obj != null);
6565
Contract.Requires(resultSelector != null);
6666

67-
return This.YieldInsertOrReplaceAll(tableMapping, new T[] {obj}, resultSelector).First().Value;
67+
return This.YieldInsertOrReplaceAll(tableMapping, new TInserted[] {obj}, resultSelector).First().Value;
6868
}
6969

7070
/// <summary>
@@ -75,11 +75,11 @@ public static T InsertOrReplace<T>(
7575
/// <param name="tableMapping">The table mapping.</param>
7676
/// <param name="objects">The objects to be inserted into the database.</param>
7777
/// <typeparam name="T">The mapped type.</typeparam>
78-
public static IReadOnlyDictionary<T,T> InsertOrReplaceAll<T>(
78+
public static IReadOnlyDictionary<TInserted,TResult> InsertOrReplaceAll<TInserted, TResult>(
7979
this IDatabaseConnection This,
8080
TableMapping tableMapping,
81-
IEnumerable<T> objects,
82-
Func<IReadOnlyList<IResultSetValue>,T> resultSelector)
81+
IEnumerable<TInserted> objects,
82+
Func<IReadOnlyList<IResultSetValue>,TResult> resultSelector)
8383
{
8484
Contract.Requires(This != null);
8585
Contract.Requires(tableMapping != null);
@@ -103,11 +103,11 @@ public static partial class AsyncDatabaseConnection
103103
/// <param name="objects">The objects to be inserted into the database.</param>
104104
/// <param name="ct">A cancellation token that can be used to cancel the operation</param>
105105
/// <typeparam name="T">The mapped type.</typeparam>
106-
public static Task<IReadOnlyDictionary<T,T>> InsertOrReplaceAllAsync<T>(
106+
public static Task<IReadOnlyDictionary<TInserted, TResult>> InsertOrReplaceAllAsync<TInserted, TResult>(
107107
this IAsyncDatabaseConnection This,
108108
TableMapping tableMapping,
109-
IEnumerable<T> objects,
110-
Func<IReadOnlyList<IResultSetValue>,T> resultSelector,
109+
IEnumerable<TInserted> objects,
110+
Func<IReadOnlyList<IResultSetValue>,TResult> resultSelector,
111111
CancellationToken ct)
112112
{
113113
Contract.Requires(This != null);
@@ -126,11 +126,11 @@ public static Task<IReadOnlyDictionary<T,T>> InsertOrReplaceAllAsync<T>(
126126
/// <param name="tableMapping">The table mapping.</param>
127127
/// <param name="objects">The objects to be inserted into the database.</param>
128128
/// <typeparam name="T">The mapped type.</typeparam>
129-
public static Task<IReadOnlyDictionary<T,T>> InsertOrReplaceAllAsync<T>(
129+
public static Task<IReadOnlyDictionary<TInserted, TResult>> InsertOrReplaceAllAsync<TInserted, TResult>(
130130
this IAsyncDatabaseConnection This,
131131
TableMapping tableMapping,
132-
IEnumerable<T> objects,
133-
Func<IReadOnlyList<IResultSetValue>,T> resultSelector)
132+
IEnumerable<TInserted> objects,
133+
Func<IReadOnlyList<IResultSetValue>,TResult> resultSelector)
134134
{
135135
Contract.Requires(This != null);
136136
Contract.Requires(tableMapping != null);

0 commit comments

Comments
 (0)