jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReliableConnection and Azure Cloud Databases not working with AsParallel and Auto Interface Implementation

keerthirajap opened this issue · comments

ReliableConnection and Azure Cloud Databases retry logic not working with AsParallel and Auto Interface Implementation

Startup.cs file

`
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
var strategy = new RetryStrategy();

        strategy.MaxRetryCount = 5;
        strategy.MinBackOff = new TimeSpan(0, 0, 0, 0, 100); // 100 ms
        strategy.MaxBackOff = new TimeSpan(0, 0, 0, 1, 0); // 1 s
        strategy.IncrementalBackOff = new TimeSpan(0, 0, 0, 0, 100); // 100 ms

        strategy.Retrying += (sender, re) =>
        {
            this._logger.LogWarning("Retrying. Attempt {0}", re.Attempt);
        };

        string sqlConnectionString = this.Configuration["DatabaseSetting:SqlDbConnection"];

        var sqlConnection = new ReliableConnection<SqlConnection>(sqlConnectionString, strategy);

        services.AddTransient(b => sqlConnection.AsParallel<IUserRepository>());
    }

}
`

IUserRepository.cs

`
public interface IUserRepository
{

    [Sql(@"[dbo].[P_GetUserInfo]")]
    Task<UserInfo> GetUserInfoAsync(long userId);      
}

`

UserController.cs

public class UserController : ControllerBase { public UserController(IUserRepository userRepository) { this._userRepository = userRepository; } }

  • Dotnet version: [netcore6,]
  • Database: [SQL Server]
  • Library version: [6.3.9]
commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Any updates?

Hi @keerthirajap in my case I've been swamped with my day job, so ive had no bandwidth to take a look, I see you posted a snippet, but do you have a repro prj where we could emulate the behavior?

Will create a repo and get back to you.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Feel free to reopen if you manage to generate a repro.