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);
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
public static class PredicateBuilder | |
{ | |
/// <summary> | |
/// Creates a predicate that evaluates to true. | |
/// </summary> | |
public static Expression<Func<T, bool>> True<T>() { return param => true; } | |
/// <summary> | |
/// Creates a predicate that evaluates to false. | |
/// </summary> |
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
const axios = require('axios'); | |
const getData = async function(clientId) { | |
const options = { | |
method: 'get', | |
url: 'https://api.example.net/some-data/' + clientId, | |
headers: { | |
'Content-Type': 'application/json', | |
'x-api-version': '3' |
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.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; |
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
// 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 | |
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
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
public class BusinessService | |
{ | |
private readonly ILogger _logger; | |
public BusinessService(ILogger logger) | |
{ | |
_logger = logger; | |
} | |
public void SomeMethod() |
- Принимаем реальность и работаем с ней.
- Нет ничего страшного в том, что мы допускаем ошибки; страшно, когда мы не учимся на них.
- Мы выявляем проблемы и не миримся с ними. Мы исправляем их и делаем выводы.
- Мы используем инструменты и утвержденные процедуры, чтобы регламентировать выполнение работы.
- Явное лучше неявного
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
public class Controller : ControllerBase { | |
[HttpPost("sql/read")] | |
public async Task<IActionResult> ExecuteReadSqlAsync([FromBody] SqlCommandRequest request) | |
{ | |
request | |
.ThrowIfNull(nameof(request)) | |
.ThrowIfInvalid(); | |
var table = new DataTable(); |
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
class Animal : ICloneable<Animal> | |
{ | |
public virtual Animal Clone() | |
{ | |
return new Animal(this); | |
} | |
} | |
// нет переопределения метода | |
class Dog : Animal |
NewerOlder