-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
99 changed files
with
2,730 additions
and
1,492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Data.SqlClient; | ||
using Polly; | ||
using Polly.Retry; | ||
|
||
namespace NPoco.SqlServer | ||
{ | ||
public class DefaultPollyPolicy : IPollyPolicy | ||
{ | ||
public virtual RetryPolicy RetryPolicy { get; set; } = RetryPolicyImp; | ||
|
||
public virtual AsyncRetryPolicy AsyncRetryPolicy { get; set; } = RetryPolicyAsyncImp; | ||
|
||
public static IEnumerable<TimeSpan> RetryTimes { get; set; } = new[] | ||
{ | ||
TimeSpan.FromSeconds(1), | ||
TimeSpan.FromSeconds(3), | ||
TimeSpan.FromSeconds(5) | ||
}; | ||
|
||
private static readonly AsyncRetryPolicy RetryPolicyAsyncImp = Policy | ||
.Handle<SqlException>(SqlServerTransientExceptionDetector.ShouldRetryOn) | ||
.Or<TimeoutException>() | ||
.WaitAndRetryAsync(RetryTimes); | ||
|
||
private static readonly RetryPolicy RetryPolicyImp = Policy | ||
.Handle<SqlException>(SqlServerTransientExceptionDetector.ShouldRetryOn) | ||
.Or<TimeoutException>() | ||
.WaitAndRetry(RetryTimes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Polly.Retry; | ||
|
||
namespace NPoco.SqlServer | ||
{ | ||
public interface IPollyPolicy | ||
{ | ||
RetryPolicy RetryPolicy { get; set; } | ||
AsyncRetryPolicy AsyncRetryPolicy { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Description>An extremely easy to use Micro-ORM supporting Sql Server.</Description> | ||
<VersionPrefix>5.0.0</VersionPrefix> | ||
<TargetFrameworks>net461;netstandard2.0;netstandard2.1</TargetFrameworks> | ||
<AssemblyName>NPoco.SqlServer</AssemblyName> | ||
<PackageId>NPoco.SqlServer</PackageId> | ||
<Authors>Adam Schröder</Authors> | ||
<PackageTags>orm;sql;micro-orm;database;mvc</PackageTags> | ||
<PackageProjectUrl>https://github.com/schotime/NPoco</PackageProjectUrl> | ||
<LangVersion>8.0</LangVersion> | ||
<nullable>enable</nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.1" /> | ||
<PackageReference Include="Polly" Version="7.2.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\NPoco\NPoco.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.