🤹♂️
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.Runtime.CompilerServices; | |
using Microsoft.Extensions.Logging; | |
public static class LogActions | |
{ | |
/// <summary> | |
/// Log the current Method call and any relevant | |
/// parameter(s) <paramref name="loggableState"/> at log level <see cref="LogLevel.Information"/> | |
/// </summary> | |
/// <param name="log">the ILogger.</param> |
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
// Licensed to the .NET Foundation under one or more agreements. | |
// The .NET Foundation licenses this file to you under the MIT license. | |
// | |
// License statement and more attributes source code at | |
// https://github.com/dotnet/runtime/tree/main/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices | |
// | |
// ReSharper disable CheckNamespace | |
using System.ComponentModel; | |
namespace System.Runtime.CompilerServices |
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; | |
/// <summary> | |
/// Parse things without throwing an Exception by returning a default value on failure | |
/// </summary> | |
public static class Parse | |
{ | |
public static int ToInt(this string value, int defaultValue=0) => IntElse(value,defaultValue); | |
/// <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
using System.Collections; | |
/// <summary> | |
/// A <see cref="IDisposable"/> wrapper for a <see cref="T[]"/> which, when it is disposed, | |
/// disposes each of its non-null elements. | |
/// </summary> | |
public class DisposableArray<T> : Array<T>, IDisposable where T : IDisposable | |
{ | |
public DisposableArray(IEnumerable<T> items):base(items){} | |
public DisposableArray(int size):base(size){} |
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 Microsoft.EntityFrameworkCore.Infrastructure; | |
using Microsoft.EntityFrameworkCore.Migrations; | |
// ReSharper disable InconsistentNaming | |
#region migrations | |
[Migration(nameof(Script1))]public class Script1 : MigrationConfiguredWithScriptDirectoryAndDbContext{} | |
[Migration(nameof(Script2))]public class Script2 : MigrationConfiguredWithScriptDirectoryAndDbContext{} | |
#endregion |
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.Collections.Generic; | |
using System.Security.Claims; | |
using System.Security.Principal; | |
public class FakeClaimsIdentity : ClaimsIdentity | |
{ | |
public readonly List<Claim> ClaimsValue = new List<Claim>(); | |
public bool IsAuthenticatedSet; |
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 namespace System.Diagnostics | |
using namespace System.Collections | |
using namespace System.Collections.Generic | |
using namespace System.IO.Compression | |
param ( [switch]$NoRun ) | |
function Assert( [bool]$condition, [string]$message = "Assertion failed" ){ | |
if( -not $condition ) { | |
Get-PSCallStack | ForEach-Object { Write-Host $_.FunctionName $_.Location $_.Arguments } |
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
# Populate Web.config EnvironmentVariables from Pipeline variables | |
# | |
# Usage: Copy-paste this script into a Powershell Task, as an inline script, in your release pipeline. | |
# | |
# ----------------------------------------------------- | |
# Known Variables: | |
# DOTNET_ENVIRONMENT | |
# TraceTransforms | |
# ----------------------------------------------------- | |
# Editing this script: |
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
task: PowerShell@2 | |
displayName: "Dev Azure tasks and GOTCHAS" | |
inputs: | |
targetType: 'inline' | |
script: | | |
# Write your PowerShell commands here. | |
@" | |
DevAzure tasks and GOTCHAS: NuGet.config, MsBuild Path, Unit Tests, Integration Tests | |
"@ |
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
/// <summary> | |
/// A SoftDictionary is a <see cref="Dictionary{TKey,TValue}"/> which does not | |
/// throw if you try to to access a non-existent entry. Instead, it returns <c>default(TValue)</c> | |
/// </summary> | |
/// <typeparam name="TKey"></typeparam> | |
/// <typeparam name="TValue"></typeparam> | |
public class SoftDictionary<TKey,TValue> : Dictionary<TKey,TValue> where TKey : notnull | |
{ | |
/// <inheritdoc cref="IDictionary{TKey,TValue}"/> | |
/// <remarks> |
NewerOlder