Skip to content

Instantly share code, notes, and snippets.

View IanYates's full-sized avatar

Ian Yates IanYates

View GitHub Profile
@IanYates
IanYates / HangFireWindsor.cs
Created January 20, 2016 23:30
Proper integration between Hangfire and Windsor - does not take advantage of new HangFire 1.5 IoC features
To configure Hangfire
//Windsor integration
//The activator
var jobActivator = new WindsorScopedJobActivator(windsorContainer);
GlobalConfiguration.Configuration.UseActivator(jobActivator);
//And something to create and dispose of a child container in the activator for each job
var windsorJobFilter = new WindsorContainerPerJobFilterAttribute(jobActivator);
GlobalJobFilters.Filters.Add(windsorJobFilter);
namespace Serilog.Exceptions
{
using System;
using System.Collections.Generic;
using System.Linq;
public class AggregateExceptionDestructurer : ExceptionDestructurer
{
public override Type[] TargetTypes
{
@IanYates
IanYates / DelayedRenderExtensions.cs
Created November 3, 2015 02:02 — forked from zaus/DelayedRenderExtensions.cs
RenderSections in PartialViews -- delayed rendering of any HTML content. See SO answer: http://stackoverflow.com/a/18790222/1037948
public static class HtmlRenderExtensions {
/// <summary>
/// Delegate script/resource/etc injection until the end of the page
/// <para>@via http://stackoverflow.com/a/14127332/1037948 and http://jadnb.wordpress.com/2011/02/16/rendering-scripts-from-partial-views-at-the-end-in-mvc/ </para>
/// </summary>
private class DelayedInjectionBlock : IDisposable {
/// <summary>
/// Unique internal storage key
/// </summary>
@IanYates
IanYates / gist:7f31abe19610ca653a3b
Created May 30, 2015 03:23
System.Diagnostics.TraceListener to Windsor ILogger
using System;
using System.Diagnostics;
using System.Globalization;
using Castle.Core.Logging;
namespace Dox.Server.Web.Utilities.Logging
{
/// <summary>
/// TraceListener implementation that directs all output to Serilog via the Windsor ILogger
/// </summary>