🧗♂️
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
"Watch": { | |
"commandName": "Executable", | |
"executablePath": "dotnet.exe", | |
"workingDirectory": "$(ProjectDir)", | |
"commandLineArgs": "watch run", | |
"launchBrowser": true, | |
"launchUrl": "https://localhost:5001;http://localhost:5000", | |
"environmentVariables": { | |
"ASPNETCORE_ENVIRONMENT": "Development", | |
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net6.0</TargetFramework> | |
<Nullable>enable</Nullable> | |
<LangVersion>preview</LangVersion> | |
</PropertyGroup> | |
<ItemGroup> |
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 void ConfigureServices(IServiceCollection services) | |
{ | |
//.... | |
services.AddDbContextPool<S2ReadDbContext>(options => | |
{ | |
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); | |
options.UseSqlServer(Configuration.GetConnectionString("S2ReadConnection")); | |
options.EnableSensitiveDataLogging(); |
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 virtual ValueTask DisposeAsync() | |
{ | |
try | |
{ | |
Dispose(); | |
return default; | |
} | |
catch (Exception exc) | |
{ | |
return new ValueTask(Task.FromException(exc)); |
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 Person { | |
public Person (string first, string last) => (this.First, this.Last) = (first, last); | |
} | |
public static class Extensions { | |
public static void Deconstruct(this Person p, out string first, out string last) => (first, last) = (p.First, p.Last); | |
} |
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
var options = new DbContextOptionsBuilder<MyDbContext> | |
.UseInMemoryDatabase(Guid.NewGuid().ToString()) | |
.Options; | |
var context = new MyDbContext(options); | |
context.Database.EnsureCreated(); |
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
var dbResult = await this._readDbContext.ProductCategories.FromSqlInterpolated($@" | |
SELECT TOP 1 * | |
FROM [biz].[ProductCategories] t | |
WHERE NOT EXISTS (SELECT 1 | |
FROM [biz].[ProductCategories] | |
WHERE ParentProductCategoryId = t.ProductCategoryId) | |
AND t.ProductCategoryId = {parameters.CategoryId} AND MerchantId = {merchantId}") | |
.AsNoTracking().FirstOrDefaultAsync(); |
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 IWebHostBuilder CreateWebHostBuilder(string[] args) => | |
WebHost.CreateDefaultBuilder(args) | |
.ConfigureLogging(logging => | |
{ | |
logging.ClearProviders(); | |
logging.AddDebug().AddConsole(); | |
logging.AddFilter("", LogLevel.Information) | |
.AddFilter("Microsoft.AspNetCore.Routing.EndpointMiddleware", LogLevel.Warning) | |
.AddFilter("Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker", LogLevel.Warning) | |
.AddFilter("Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor", LogLevel.Warning); |
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
<PropertyGroup> | |
<Nullable>enable</Nullable> | |
<TargetFramework>net6.0</TargetFramework> | |
<LangVersion>Preview</LangVersion> | |
<EnablePreviewFeatures>true</EnablePreviewFeatures> | |
</PropertyGroup> |
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
dotnet tool install --global dotnet-ef |
OlderNewer