- Принимаем реальность и работаем с ней.
- Нет ничего страшного в том, что мы допускаем ошибки; страшно, когда мы не учимся на них.
- Мы выявляем проблемы и не миримся с ними. Мы исправляем их и делаем выводы.
- Мы используем инструменты и утвержденные процедуры, чтобы регламентировать выполнение работы.
- Явное лучше неявного
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 Startup | |
{ | |
// ... | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
// ... | |
services | |
.Configure<ApiBehaviorOptions>(x => | |
{ | |
x.InvalidModelStateResponseFactory = ctx => new ValidationProblemDetailsResult(); |
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.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
using Utils.Serialization; | |
namespace YourNamespace | |
{ | |
public class ValidationProblemDetailsResult : IActionResult | |
{ |
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 |
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; } |
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 |
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(); |
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() |
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
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);