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
public abstract class BaseConsumer(IRedisClient redisClient) : BackgroundService | |
{ | |
private readonly string _consumerName = Guid.NewGuid().ToString(); | |
private readonly IDatabase _database = redisClient.GetDefaultDatabase().Database; | |
protected abstract int ReadMaxCount { get; } | |
protected abstract string StreamName { get; } | |
protected abstract string GroupName { get; } | |
protected async Task Consume | |
( |
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
<?php | |
// Function to fetch data from MySQL database | |
function fetchDataFromDatabase() { | |
// Replace these with your MySQL database credentials | |
$servername = "your_mysql_host"; | |
$username = "your_mysql_username"; | |
$password = "your_mysql_password"; | |
$dbname = "your_mysql_database"; |
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
using BenchmarkDotNet.Attributes; | |
namespace HashSetDemo; | |
public class Benchmarks | |
{ | |
private static readonly HashSet<foo1> hashset1 = new HashSet<foo1>(); | |
private static readonly HashSet<foo2> hashset2 = new HashSet<foo2>(); | |
[GlobalSetup] |
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
using BenchmarkDotNet.Attributes; | |
namespace HashSetDemo; | |
public class Benchmarks | |
{ | |
private static readonly HashSet<foo1> hashset1 = new HashSet<foo1>(); | |
private static readonly HashSet<foo2> hashset2 = new HashSet<foo2>(); | |
[GlobalSetup] |
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
using System.ComponentModel; | |
using System.Globalization; | |
using AutoMapper; | |
using FastExpressionCompiler; | |
using Mapster; | |
using Nelibur.ObjectMapper; | |
using RunTimeMapping.Models; | |
using RunTimeMapping.Models.MapperlyMappers; | |
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
using System.Linq; | |
using FastExpressionCompiler; | |
using Mapster; | |
namespace foobar; | |
public static class MappingConfiguration | |
{ | |
public static TypeAdapterConfig Generate() | |
{ |
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
public static class EFQueryExtensions | |
{ | |
public static async Task<T[]> ToArrayAsyncWithCache<T>(this IQueryable<T> query, | |
IRedisClient cache, string key, TimeSpan expire = default) | |
{ | |
var cachedData = await cache.Db0.GetAsync<T[]>(key, CommandFlags.PreferReplica); | |
if (cachedData != null) return cachedData; | |
var data = await query.ToArrayAsync(); |
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
public class CustomException : Exception | |
{ | |
public CustomException(CustomError customError) | |
{ | |
CustomError = customError; | |
} | |
public CustomError CustomError { 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
public class CustomErrors | |
{ | |
public static CustomError E_100 = new(nameof(E_100), "Beklenmedik bir sistem hatası oluştu!"); | |
public static CustomError E_200 = new(nameof(E_200), "Kullanıcı adı veya parola hatalı!"); | |
public static CustomError E_201 = new(nameof(E_201), "Eposta zaten kayıtlı!"); | |
public static CustomError E_202 = new(nameof(E_202), "Bütün alanları doldurunuz!"); |
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
public class ExceptionMiddleware | |
{ | |
private readonly RequestDelegate _next; | |
public ExceptionMiddleware(RequestDelegate next) | |
{ | |
_next = next; | |
} | |
public async Task Invoke(HttpContext context, ILogger<ExceptionMiddleware> logger) |
NewerOlder