Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 29b8c5d

Browse files
committed
Only include async code in NET45 builds
1 parent 10d1523 commit 29b8c5d

15 files changed

+80
-20
lines changed

src/ServiceStack.OrmLite/Async/OrmLiteReadCommandExtensionsAsync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) Service Stack LLC. All Rights Reserved.
1+
#if NET45
2+
// Copyright (c) Service Stack LLC. All Rights Reserved.
23
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
34

45
using System;
@@ -472,4 +473,5 @@ public static async Task LoadReferencesAsync<T>(this IDbCommand dbCmd, T instanc
472473
return loadList.ParentResults;
473474
}
474475
}
475-
}
476+
}
477+
#endif

src/ServiceStack.OrmLite/Async/OrmLiteResultsFilterExtensionsAsync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) Service Stack LLC. All Rights Reserved.
1+
#if NET45
2+
// Copyright (c) Service Stack LLC. All Rights Reserved.
23
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
34

45
using System;
@@ -200,4 +201,5 @@ internal static Task<Dictionary<K, List<V>>> LookupAsync<K, V>(this IDbCommand d
200201
.Then(reader => reader.LookupAsync<K,V>(token)).Unwrap();
201202
}
202203
}
203-
}
204+
}
205+
#endif

src/ServiceStack.OrmLite/Async/OrmLiteUtilExtensionsAsync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) Service Stack LLC. All Rights Reserved.
1+
#if NET45
2+
// Copyright (c) Service Stack LLC. All Rights Reserved.
23
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
34

45
using System;
@@ -86,4 +87,5 @@ public static Task<IList> ConvertToListAsync(this IDataReader dataReader, Type t
8687
}
8788
}
8889
}
89-
}
90+
}
91+
#endif

src/ServiceStack.OrmLite/Async/OrmLiteWriteCommandExtensionsAsync.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if NET45
12
// Copyright (c) Service Stack LLC. All Rights Reserved.
23
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
34

@@ -492,3 +493,4 @@ internal static Task<ulong> GetRowVersionAsync(this IDbCommand dbCmd, ModelDefin
492493
}
493494
}
494495
}
496+
#endif

src/ServiceStack.OrmLite/Async/ReadExpressionCommandExtensionsAsync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) Service Stack LLC. All Rights Reserved.
1+
#if NET45
2+
// Copyright (c) Service Stack LLC. All Rights Reserved.
23
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
34

45
using System;
@@ -181,4 +182,5 @@ internal static Task<List<T>> Select<T>(this IDbCommand dbCmd, Expression<Func<T
181182
}
182183

183184
}
184-
}
185+
}
186+
#endif

src/ServiceStack.OrmLite/Async/WriteExpressionCommandExtensionsAsync.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if NET45
12
using System;
23
using System.Data;
34
using System.Linq.Expressions;
@@ -116,4 +117,4 @@ internal static Task<int> DeleteFmtAsync(this IDbCommand dbCmd, string table, st
116117
}
117118
}
118119
}
119-
120+
#endif

src/ServiceStack.OrmLite/OrmLiteDialectProviderBase.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,7 @@ public virtual string EscapeWildcards(string value)
14431443
return reader.Read().InTask();
14441444
}
14451445

1446+
#if NET45
14461447
public virtual async Task<List<T>> ReaderEach<T>(IDataReader reader, Func<T> fn, CancellationToken token = default(CancellationToken))
14471448
{
14481449
try
@@ -1502,5 +1503,27 @@ public virtual Task<long> InsertAndGetLastInsertIdAsync<T>(IDbCommand dbCmd, Can
15021503

15031504
return dbCmd.ExecLongScalarAsync(null, token);
15041505
}
1506+
#else
1507+
public Task<List<T>> ReaderEach<T>(IDataReader reader, Func<T> fn, CancellationToken token = new CancellationToken())
1508+
{
1509+
throw new NotImplementedException(OrmLiteUtilExtensions.AsyncRequiresNet45Error);
1510+
}
1511+
1512+
public Task<Return> ReaderEach<Return>(IDataReader reader, Action fn, Return source, CancellationToken token = new CancellationToken())
1513+
{
1514+
throw new NotImplementedException(OrmLiteUtilExtensions.AsyncRequiresNet45Error);
1515+
}
1516+
1517+
public Task<T> ReaderRead<T>(IDataReader reader, Func<T> fn, CancellationToken token = new CancellationToken())
1518+
{
1519+
throw new NotImplementedException(OrmLiteUtilExtensions.AsyncRequiresNet45Error);
1520+
}
1521+
1522+
public Task<long> InsertAndGetLastInsertIdAsync<T>(IDbCommand dbCmd, CancellationToken token)
1523+
{
1524+
throw new NotImplementedException(OrmLiteUtilExtensions.AsyncRequiresNet45Error);
1525+
}
1526+
#endif
1527+
15051528
}
15061529
}

src/ServiceStack.OrmLite/OrmLiteReadApiAsync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) Service Stack LLC. All Rights Reserved.
1+
#if NET45
2+
// Copyright (c) Service Stack LLC. All Rights Reserved.
23
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
34

45
using System;
@@ -563,4 +564,5 @@ public static Task<T> LoadSingleByIdAsync<T>(this IDbConnection dbConn, object i
563564
return dbConn.Exec(dbCmd => dbCmd.LoadReferencesAsync(instance, token));
564565
}
565566
}
566-
}
567+
}
568+
#endif

src/ServiceStack.OrmLite/OrmLiteReadExpressionsApiAsync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) Service Stack LLC. All Rights Reserved.
1+
#if NET45
2+
// Copyright (c) Service Stack LLC. All Rights Reserved.
23
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
34

45
using System;
@@ -195,4 +196,5 @@ public static Task<TKey> ScalarAsync<T, TKey>(this IDbConnection dbConn,
195196
}
196197
}
197198

198-
}
199+
}
200+
#endif

src/ServiceStack.OrmLite/OrmLiteUtilExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ namespace ServiceStack.OrmLite
2020
{
2121
public static class OrmLiteUtilExtensions
2222
{
23+
internal const string AsyncRequiresNet45Error = "Async support is only available in .NET 4.5 builds";
24+
2325
public static T CreateInstance<T>()
2426
{
2527
return (T)ReflectionExtensions.CreateInstance<T>();

0 commit comments

Comments
 (0)