Kayıtlar

HttpClientFactory üzerinden x-www-form-urlencoded body ile form post etme

Aşağıdaki kod örneğinde olduğu gibi veri post edilir 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 var response = new TokenWrapModel(); var client = _httpClientFactory.CreateClient(); client.BaseAddress = new Uri(_configuration.GetValue< string >( "Authority" )); var data = new [] { new KeyValuePair< string , string >( "client_id" , _configuration.GetValue< string >( "ClientId" )), new KeyValuePair< string , string >( "client_secret" , _configuration.GetValue< string >( "ClientSecret" )), new KeyValuePair< string , string >( "grant_type" , _configuration.GetValue< string >( "GrantType" )), }; var result = await ...

09.04.2022 akış

Resim
 Postgresql ve Mysql kurulumu mysql shell shell.connect({host: ' localhost ' ,user: ' root ' }) şifre soracak root passworde bunu gir Password12* sql moda girmek için \sql yaz ve sql modu devreye girsin Alternatif version mysql workbench Visual Studio Code üzerinde SQLTools extension kurdum, bu extension ayrıca mysql ve postgresql için driver istiyor marketplace ' den ilgili driverları indirdim. Mysql ' de query çalıştırınca aşağıdaki hatayı verdi ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server ; consider upgrading MySQL client Bu hatanın sebebi bizim kurulum yaparken güçlü şifre seçmemizden kaynaklanıyor. Bunu düzeltmek için mysql üzerinde workbench kullanarak başka bir ayar yapacağız ALTER USER ' root ' @ ' localhost ' IDENTIFIED WITH mysql_native_password BY ' Password12* '

08.04.2022 akış

Program.cs içinde App'imize serilog ekliyoruz. Aşağıdaki kütüphaneleri nuget üzerinden yüklüyoruz Serilog.AspNetCore Serilog.Exceptions Serilog.Extensions.Logging Serilog.Sinks.Console Serilog.Sinks.RollingFile 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 public static int Main ( string [] args) { //Loglamayı başlatıyoruz ILogger logger = new LoggerConfiguration() .MinimumLevel.Information() .MinimumLevel.Override( "Microsoft" , LogEventLevel.Warning) .MinimumLevel.Override( "Microsoft.AspNetCore.Mvc" , LogEventLevel.Error) .MinimumLevel.Override( "Microsoft" , LogEventLevel.Information) //.Enrich.FromLogContext() .Enrich.WithExcepti...

07.04.2022 akış

 Nuget paket yönetiminde datayı excele yazdıran veya excelden okuyan bir sürü alternatif yazılım kütüphanesi mevcut ancak bu çözümlerin çoğu paralı ve seri numarası ister. Ücretsiz bir excel kütüphanesi isterseniz size bu kütüphaneyi öneririm.  Excel Helper 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 public class ExcelHelper { public static ExcelReadDataDto GetExcelReadData (IFormFile file, string filePath) { ...

05.04.2022 akış

 Visual Studio 2022 ile projeyi ayağa kaldırırken şu şekilde bir hata alıyorsanız one or more errors occured Failed to launch debug adapter Additional information may be available in the output window Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target : Sorunun çözümü için link

03.04.2022 akış

- Asp.net Mvc modeli yerine yeni bir minimal api tarzı fastendpoints Kodları incelemek için kütüphane Link - Dökümantasyon Link - Visual studio üzerinde gitignore dosyası eklemek için kısayol Link -Youtube yeni api dökümantasyonu Link

01.04.2022 akış

 C# eventleri klasik biçimde kullanmak yerine mediator patternin notification özelliğini kullanarak tasarlayabiliriz Link Loglama deyip geçmeyin dotnet üzerinde serilog kullanarak değişik açılımlar yapabilirsiniz Link serilog.extensions.logging serilog.sinks.console builder.Logging.ClearProviders(); ILogger logger = new LoggerConfiguration() .WriteTo.Console() .CreateLogger(); builder.Logging.AddSerilog(logger); builder.Services.AddSingleton(logger);