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.Concurrent; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
namespace System.Reflection.AttributeSearch | |
{ | |
/// <summary> | |
/// BBernard |
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.Concurrent; | |
public class SimpleLazyCacheHelper<T> where T: class | |
{ | |
private readonly ConcurrentDictionary<string, Lazy<T>> _cache = new ConcurrentDictionary<string, Lazy<T>>(); | |
[Obsolete("This method adds existing values to the cache, but it's best to use GetOrAddToCache() to facilitate a self-populating cache (especially in a Web environment)")] | |
public void AddToCache(string key, T 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
#************************************************************************************************** | |
#COPY All Secrets from Source KeyVault to Destination (with ContentType) | |
#Originally Inspired by the StackOverflow post here: https://stackoverflow.com/a/55618194/7293142 | |
# To Use: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps | |
# 1) Ensure you have permission to execute in PowerShell: | |
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
# 2) Install Azure "Az" Modeule: | |
# Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force | |
#************************************************************************************************** | |
Param( |
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.Linq; | |
using System.Text; | |
namespace CajunCoding.UniqueIds | |
{ | |
/// <summary> | |
/// BBernard / CajunCoding | |
/// A simple, relatively efficient, class for generating very unique Ids of arbitrary length. | |
/// They are not guaranteed to universally unique but the risk of collisions is of no practical implication for many uses |
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 CajunCoding | |
{ | |
/// <summary> | |
/// Simple but effective Retry mechanism for C# with Exponential backoff and support for validating each result to determine if it should continue trying or accept the result. | |
/// https://en.wikipedia.org/wiki/Exponential_backoff | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="maxRetries">The Max number of attempts that will be made.</param> | |
/// <param name="action">The Func<T> process/action that will be attempted and will return generic type <T> when successful.</param> | |
/// <param name="validationAction">A dynamic validation rule that can determine if a given result of generic type <T> is acceptable or if the action should be re-attempted.</param> |
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
/// <summary> | |
/// Adapted from original lightweight async reader/writer implementation on Stack Overflow: | |
/// https://stackoverflow.com/a/64757462/7293142 | |
/// The answered question was then improved and posted via comment here: | |
/// https://github.com/copenhagenatomics/CA_DataUploader/pull/90/files#diff-24a9664c904fe9276878f37dc1438aae578a76b7ef34eabbebf6ac66eaad83e6 | |
/// | |
/// Released under the same Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licensing as the original StackOverflow source: | |
/// https://creativecommons.org/licenses/by-sa/4.0/ | |
/// | |
/// This (@CajunCoding) version adds support for simplified using(){} notation via IDisposable so that Try/Finally blocks are not needed. |
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.Security.Cryptography; | |
using System.Text; | |
namespace CajunCoding.PKCE | |
{ | |
/// <summary> | |
/// BBernard / CajunCoding | |
/// A simple class to generate Proof Key for Code Exchange (PKCE) codes to be used in the Authorization code authentication flow. | |
/// |
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.Linq; | |
using System.Security.Cryptography; | |
using System.Text; | |
namespace CajunCoding.HMAC | |
{ | |
/// <summary> | |
/// BBernard / CajunCoding | |
/// A simple class to generate HMAC codes (hash-based message authentication code) to be used for signing and validating |
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 HotChocolate.Execution.Instrumentation; | |
using HotChocolate.Execution; | |
using System; | |
using System.Diagnostics; | |
using System.Linq; | |
using Aeg.Common.CSharp.CustomExtensions; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Extensions.DependencyInjection; | |
using GraphQL.HotChocolate.AzureFunctions.Authorization; | |
using System.Security.Claims; |
OlderNewer