Skip to content

Instantly share code, notes, and snippets.

@Nico-VanHaaster
Nico-VanHaaster / DnsLookup.cs
Last active July 28, 2020 18:51
Cancel DNS.BeginGetHostEntry
using System;
using System.Net;
using System.Threading.Tasks;
namespace DnsLookup
{
class Program
{
static void Main(string[] args)
{
@rowanmiller
rowanmiller / Demo.cs
Last active November 5, 2019 09:12
EF6.x | Correlating SQL to code
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Infrastructure.Interception;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace Demo
@jayharris
jayharris / LogInjectionModule
Created January 28, 2013 08:21
Autofac Module to inject log4net ILog properties with type-specific Logs.
public class LogInjectionModule : Module {
protected override void AttachToComponentRegistration(IComponentRegistry registry,
IComponentRegistration registration) {
registration.Preparing += OnComponentPreparing;
var implementationType = registration.Activator.LimitType;
var injectors = BuildInjectors(implementationType).ToArray();
if (!injectors.Any()) {
return;