This file contains hidden or 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
| using Microsoft.EntityFrameworkCore.Diagnostics; | |
| using System.Data.Common; | |
| namespace EntityFrameworkExamples; | |
| public class SlowQueryInterceptor(ILogger<SlowQueryInterceptor> logger) : DbCommandInterceptor | |
| { | |
| private const int _slowQueryThresholdInMilliseconds = 5; //from config | |
| public override DbDataReader ReaderExecuted( |
This file contains hidden or 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
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Columns; | |
| using BenchmarkDotNet.Configs; | |
| using BenchmarkDotNet.Reports; | |
| using Microsoft.EntityFrameworkCore; | |
| using System.Threading.Tasks; | |
| namespace EntityFrameworkBenchmarks; | |
| [Config(typeof(Config))] |
This file contains hidden or 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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using BenchmarkDotNet.Attributes; | |
| using Microsoft.EntityFrameworkCore; | |
| namespace Benchmarks; | |
| [MemoryDiagnoser] | |
| public class QueryTrackingBehavior |
This file contains hidden or 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
| using Microsoft.AspNetCore.RateLimiting; | |
| using System.Threading.RateLimiting; | |
| var builder = WebApplication.CreateBuilder(args); | |
| builder.Services.AddRateLimiter(options => | |
| { | |
| // 1. Fixed Window Limiter (20 requests per 2 minutes) | |
| // ----------------------------------------------- | |
| // |----------------- 2 min -----------------| |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Columns; | |
| using BenchmarkDotNet.Configs; | |
| using BenchmarkDotNet.Jobs; | |
| using BenchmarkDotNet.Reports; | |
| using System; | |
| using System.Text; | |
| namespace Benchmarks | |
| { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| using Microsoft.AspNetCore.Diagnostics; | |
| namespace Samples; | |
| public class GlobalExceptionHandler(ILogger<GlobalExceptionHandler> logger) : IExceptionHandler | |
| { | |
| public ValueTask<bool> TryHandleAsync( | |
| HttpContext httpContext, | |
| Exception exception, | |
| CancellationToken cancellationToken) |
This file contains hidden or 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
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Columns; | |
| using BenchmarkDotNet.Configs; | |
| using BenchmarkDotNet.Jobs; | |
| using BenchmarkDotNet.Reports; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| namespace Benchmarks |
This file contains hidden or 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
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Columns; | |
| using BenchmarkDotNet.Configs; | |
| using BenchmarkDotNet.Jobs; | |
| using BenchmarkDotNet.Reports; | |
| using System.Runtime.CompilerServices; | |
| using System.Text; | |
| namespace Benchmarks | |
| { |
NewerOlder