var viewRows = _context.Set<TView>().ToQueryString();
var connection = _context.Database.GetDbConnection() as SqlConnection;
#pragma warning disable CA2100
var da = new SqlDataAdapter(viewRows, connection);
da.Fill(dataTable);
View AuditLogMiddleware.cs
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; | |
using System.IO; | |
using System.Linq; | |
using System.Security.Claims; | |
using System.Threading.Tasks; | |
using Database; | |
using MG.Utils.Abstract.Extensions; | |
using MG.Utils.EFCore; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.DependencyInjection; |
View Program.cs
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
// BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000 | |
// Intel Core i7-10510U CPU 1.80GHz, 1 CPU, 8 logical and 4 physical cores | |
// [Host] : .NET Framework 4.8 (4.8.4420.0), X86 LegacyJIT | |
// DefaultJob : .NET Framework 4.8 (4.8.4420.0), X86 LegacyJIT | |
// | |
// | |
// | Method | Mean | Error | StdDev | | |
// |---------------------------------------- |-----------:|-----------:|-----------:| | |
// | Replacement_WithStringReplace | 7.852 us | 0.1834 us | 0.5203 us | | |
// | Replacement_WithStringReplace_WithArray | 7.556 us | 0.1400 us | 0.2922 us | |
View EF DbSet to DataTable.md
View remove-dotnet-from-macos.md
How to remove dotnet frpm MacOs
https://github.com/dotnet/cli/blob/rel/1.0.0/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh
https://stackoverflow.com/a/44089766
To uninstall dotnet core from macOS:
- download dotnet-uninstall-pkgs.sh from https://github.com/dotnet/sdk/blob/main/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh
- make dotnet-uninstall-pkgs.sh executable
View BusinessService.cs
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 BusinessService | |
{ | |
private readonly ILogger _logger; | |
public BusinessService(ILogger logger) | |
{ | |
_logger = logger; | |
} | |
public void SomeMethod() |
View code-of-conduct.md
Кодекс команды .NET
5 принципов работы
- Принимаем реальность и работаем с ней.
- Нет ничего страшного в том, что мы допускаем ошибки; страшно, когда мы не учимся на них.
- Мы выявляем проблемы и не миримся с ними. Мы исправляем их и делаем выводы.
- Мы используем инструменты и утвержденные процедуры, чтобы регламентировать выполнение работы.
- Явное лучше неявного
View Controller.cs
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 Controller : ControllerBase { | |
[HttpPost("sql/read")] | |
public async Task<IActionResult> ExecuteReadSqlAsync([FromBody] SqlCommandRequest request) | |
{ | |
request | |
.ThrowIfNull(nameof(request)) | |
.ThrowIfInvalid(); | |
var table = new DataTable(); |
View ANimal.cs
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
class Animal : ICloneable<Animal> | |
{ | |
public virtual Animal Clone() | |
{ | |
return new Animal(this); | |
} | |
} | |
// нет переопределения метода | |
class Dog : Animal |
View F.cs
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
namespace Serializer | |
{ | |
public class F { | |
public int i1 { get; set; } | |
public int i2 { get; set; } | |
public int i3 { get; set; } | |
public int i4 { get; set; } | |
public int i5 { get; set; } | |
public F(int i) { i1 = i; i2 = i + 1; i3 = i + 2; i4 = i + 3; i5 = i + 4; } |
View ValidationProblemDetails.cs
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; | |
using System.Collections.Generic; | |
using System.Net; | |
using Microsoft.AspNetCore.Mvc; | |
namespace YourNamespace | |
{ | |
public class ValidationProblemDetails : ProblemDetails | |
{ | |
// 400 status ccode is usually used for input validation errors |
NewerOlder