Skip to content

Instantly share code, notes, and snippets.

View FuncLun's full-sized avatar

Chris Williamson FuncLun

  • St. Louis, Missour, USA
View GitHub Profile
@FuncLun
FuncLun / SQLitePCL.NativeLibraryHack.cs
Last active August 29, 2021 20:30
SQLite depends on native DLLs. In some cases, such as running xUnit tests in net48, those DLLs aren't copied to the execution folder. This hack will copy those files.
using System;
using System.Diagnostics;
using System.IO;
namespace SQLitePCL
{
public class NativeLibraryHack
{
public static bool Hacked { get; private set; }
//C# Pipeline example
var tasks = myObject
.Select(o => o.MyString)
.Where(s => s != null)
.Select(s => new Request() { Message = s })
.Select(r => r.Send(mediator))
.ToArray();
await Task.WhenAll(tasks); //There should be an extension `Task WhenAll(this IEnumerable<Task>)`
@FuncLun
FuncLun / MediatorExtensions.cs
Created September 15, 2018 05:34
Suggested extensions for Mediator
using System.Threading;
using System.Threading.Tasks;
namespace MediatR
{
public static class MediatorExtensions
{
public static Task<TResponse> Send<TResponse>(this IRequest<TResponse> request, IMediator mediator, CancellationToken cancellationToken = default)
=> mediator.Send(request, cancellationToken);