🧗♂️
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> | |
<PropertyGroup> | |
<TargetFramework>net9.0</TargetFramework> | |
<LangVersion>preview</LangVersion> | |
<EnablePreviewFeatures>true</EnablePreviewFeatures> | |
<GenerateRequiresPreviewFeaturesAttribute>true</GenerateRequiresPreviewFeaturesAttribute> | |
<Nullable>enable</Nullable> | |
<ImplicitUsings>enable</ImplicitUsings> | |
<LangVersion>Preview</LangVersion> |
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> | |
<!-- | |
This Directory.Build.props files sets default properties that apply to all projects found in | |
this folder or subfolders, recursively. | |
--> | |
<PropertyGroup> | |
<!-- Enable Build Acceleration in Visual Studio. --> | |
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio> | |
<!-- |
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
bool? isOk = dbResult is not null and { Found: true, HasAccess: var hasAccess } ? has Access : null; |
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 IEnumerable<T> AddRangeImmuted<T>(this IEnumerable<T>? source, IEnumerable<T>? items) | |
{ | |
return (source, items) switch | |
{ | |
(null, null) => Enumerable.Empty<T>(), | |
(_, null) => source, | |
(null, _) => items, | |
(_, _) => addRangeImmutedIterator(source, items) | |
}; | |
static IEnumerable<T> addRangeImmutedIterator(IEnumerable<T> source, IEnumerable<T> items) |
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
# Remove the line below if you want to inherit .editorconfig settings from higher directories | |
root = true | |
# C# files | |
[*.cs] | |
#### Core EditorConfig Options #### | |
# Indentation and spacing | |
indent_size = 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
public static void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddUnitTestServices(); | |
var result = services.BuildServiceProvider(); | |
DI.Initialize(result); | |
InitializeDatabase(); | |
} | |
private static void InitializeDatabase() | |
{ | |
var db = DI.GetService<InfraWriteDbContext>(); |
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 bool IsNullOrEmpty([NotNullWhen(false)] this string? str) => str?.Length is null or 0; | |
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? str) => str is null or { Length: 0 }; |
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 Autofac; | |
using Autofac.Extensions.DependencyInjection; | |
using HanyCo.Infra; | |
using Library.Cqrs; | |
using Library.Mapping; | |
namespace BlazorApp; |
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 Monad<TValue> | |
{ | |
private readonly TValue? _value; | |
public Monad(TValue? value) | |
=> this._value = value; | |
public Monad<TResult?> AnyWay<TResult>(in Func<TValue?, TResult?> func) | |
=> new(func(this._value)); |
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.Linq.Expressions; | |
namespace Library.Data.Linq; | |
//! Reference: http://www.albahari.com/nutshell/predicatebuilder.aspx | |
public static class PredicateBuilder | |
{ | |
public static Expression<Func<T, bool>> True<T>() => f => true; | |
public static Expression<Func<T, bool>> False<T>() => f => false; |
NewerOlder