Skip to content

Commit bef5ea9

Browse files
committed
Remove all unnecessary NET472 || NETCORE #if defs
1 parent 8e200bb commit bef5ea9

37 files changed

+7
-139
lines changed

src/ServiceStack.Client/ServerEventsClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ public ServerEventsClient Start()
234234

235235
#if NET6_0_OR_GREATER
236236
httpClient = new HttpClient(HttpClientHandlerFactory(ServiceClient), disposeHandler:true);
237+
httpClient.Timeout = Timeout.InfiniteTimeSpan;
237238

238239
var httpReq = new HttpRequestMessage(HttpMethod.Get, EventStreamUri)
239240
.With(c => c.Accept = MimeTypes.Json);
@@ -246,10 +247,9 @@ public ServerEventsClient Start()
246247
apiClient.RequestFilter = AllRequestFilters;
247248
}
248249

249-
var httpRes = httpClient.Send(httpReq);
250+
var httpRes = httpClient.Send(httpReq, HttpCompletionOption.ResponseHeadersRead);
250251
httpRes.EnsureSuccessStatusCode();
251252
var stream = httpRes.Content.ReadAsStream();
252-
253253
#else
254254
httpReq = (HttpWebRequest)WebRequest.Create(EventStreamUri);
255255
//share auth cookies

src/ServiceStack.Common/AsyncEx/AsyncManualResetEvent.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#nullable enable
2-
#if NET472 || NETCORE
32
/*
43
The MIT License (MIT)
54
@@ -514,5 +513,4 @@ public static Exception PrepareForRethrow(Exception exception)
514513
return exception;
515514
}
516515
}
517-
}
518-
#endif
516+
}

src/ServiceStack.Common/TaskExt.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ public static T GetResult<T>(this Task<T> task)
6565
public static void RunSync(Func<Task> task) => SyncTaskFactory.StartNew(task).Unwrap().GetAwaiter().GetResult();
6666
public static TResult RunSync<TResult>(Func<Task<TResult>> task) => SyncTaskFactory.StartNew(task).Unwrap().GetAwaiter().GetResult();
6767

68-
#if NET472 || NETCORE
6968
public static ValueTask AsValueTask(this Task task) => new ValueTask(task);
7069
public static ValueTask<T> AsValueTask<T>(this Task<T> task) => new ValueTask<T>(task);
71-
#endif
7270

7371
#if NET6_0_OR_GREATER
7472
public static void Wait(this ValueTask task) => task.AsTask().Wait();

src/ServiceStack.Interfaces/Caching/ICacheClientAsync.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
namespace ServiceStack.Caching
77
{
88
public interface ICacheClientAsync
9-
#if NET472 || NETCORE
109
: IAsyncDisposable
11-
#endif
12-
1310
{
1411
/// <summary>
1512
/// Removes the specified item from the cache.
@@ -114,9 +111,7 @@ public interface ICacheClientAsync
114111

115112
Task<TimeSpan?> GetTimeToLiveAsync(string key, CancellationToken token=default);
116113

117-
#if NET472 || NETCORE
118114
IAsyncEnumerable<string> GetKeysByPatternAsync(string pattern, CancellationToken token=default);
119-
#endif
120115

121116
Task RemoveExpiredEntriesAsync(CancellationToken token=default);
122117
}

src/ServiceStack.Mvc/RazorFormat.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,7 @@ public HtmlString GetErrorHtml()
11991199

12001200
public virtual IRedisClient Redis => ServiceStackProvider.Redis;
12011201

1202-
#if NET472 || NETCORE
12031202
public virtual ValueTask<IRedisClientAsync> GetRedisAsync() => ServiceStackProvider.GetRedisAsync();
1204-
#endif
12051203

12061204
public virtual IMessageProducer MessageProducer => ServiceStackProvider.MessageProducer;
12071205

src/ServiceStack.Mvc/ServiceStackController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,8 @@ public static class ServiceStackControllerExt
247247
public static object ForwardRequestToServiceStack(this ServiceStackController controller, IRequest request = null)
248248
=> controller.ServiceStackProvider.Execute(request ?? controller.ServiceStackProvider.Request);
249249

250-
#if NET472 || NETCORE
251250
public static ValueTask<IRedisClientAsync> GetRedisAsync(this ServiceStackController controller) =>
252251
controller.ServiceStackProvider.GetRedisAsync();
253-
#endif
254252
public static T TryResolve<T>(this ServiceStackController controller) => controller.ServiceStackProvider.TryResolve<T>();
255253
public static T ResolveService<T>(this ServiceStackController controller) => controller.ServiceStackProvider.ResolveService<T>();
256254
}

src/ServiceStack.Server/Auth/OrmLiteAuthRepositoryAsync.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if NET472 || NETCORE
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.Data;
54
using System.Linq;
@@ -718,4 +717,3 @@ await ExecAsync(async db =>
718717
}
719718
}
720719
}
721-
#endif

src/ServiceStack.Server/Caching/OrmLiteCacheClient.Async.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ await db.DeleteAsync<TCacheEntry>(dialect.GetQuotedColumnName("Id") + " LIKE " +
380380
}, token).ConfigAwait();
381381
}
382382

383-
#if NET472 || NETCORE
384383
public async IAsyncEnumerable<string> GetKeysByPatternAsync(string pattern, [EnumeratorCancellation] CancellationToken token = default)
385384
{
386385
var results = await ExecAsync(async db =>
@@ -405,7 +404,6 @@ public async IAsyncEnumerable<string> GetKeysByPatternAsync(string pattern, [Enu
405404
}
406405

407406
public ValueTask DisposeAsync() => default;
408-
#endif
409407

410408
public async Task RemoveExpiredEntriesAsync(CancellationToken token=default)
411409
{

src/ServiceStack/AspNet/ServiceStackPage.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ protected virtual void ServiceStack_PreLoad(object sender, EventArgs e)
101101

102102
public virtual IRedisClient Redis => ServiceStackProvider.Redis;
103103

104-
#if NET472 || NETCORE
105104
public virtual ValueTask<IRedisClientAsync> GetRedisAsync() => ServiceStackProvider.GetRedisAsync();
106-
#endif
107105

108106
public virtual IMessageProducer MessageProducer => ServiceStackProvider.MessageProducer;
109107

src/ServiceStack/Auth/ApiKeyAuthProvider.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,7 @@ public override bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Auth
217217
public override async Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token=default)
218218
{
219219
var authRepo = HostContext.AppHost.GetAuthRepositoryAsync(authService.Request);
220-
#if NET472 || NETCORE
221220
await using (authRepo as IAsyncDisposable)
222-
#else
223-
using (authRepo as IDisposable)
224-
#endif
225221
{
226222
var apiKey = GetApiKey(authService.Request, request.Password);
227223
ValidateApiKey(authService.Request, apiKey);

0 commit comments

Comments
 (0)