Skip to content

Instantly share code, notes, and snippets.

View jbogard's full-sized avatar

Jimmy Bogard jbogard

View GitHub Profile
public interface IDomainEventDispatcher
void Dispatch(IDomainEvent domainEvent);
public class DomainEventDispatcher : IDomainEventDispatcher
private readonly IContainer _container;
public DomainEventDispatcher(IContainer container)
tool = p4merge
ff = no
tool = p4merge
guitool = p4merge
renames = copies
prompt = false
public class MediatorPipeline<TRequest, TResponse>
: IRequestHandler<TRequest, TResponse>
where TRequest : IRequest<TResponse>
private readonly IRequestHandler<TRequest, TResponse> _inner;
private readonly IEnumearble<IMessageValidator<TRequest>> _validators;
public MediatorPipeline(IRequestHandler<TRequest, TResponse> inner,
IEnumerable<IMessageValidator<TRequest>> validators)
jbogard / Featurefolders.cs
Created October 3, 2013 15:55
Feature folders
public class FeatureViewLocationRazorViewEngine : RazorViewEngine
public FeatureViewLocationRazorViewEngine()
ViewLocationFormats = new[]
jbogard / UrlHelprLinkr.cs
Created December 11, 2013 21:37
Hyprlinkr + UrlHelper
using System;
using System.Linq.Expressions;
using System.Web.Http;
using System.Web.Http.Routing;
using Ploeh.Hyprlinkr;
public static class UrlHelperExtensions
public static Uri Link<T, TResult>(this UrlHelper helper, Expression<Func<T, TResult>> expression)
where T : ApiController
var config = new MapperConfiguration(cfg => {
cfg.CreateMap<Source, Dest>();
IMapper mapper = config.CreateMapper();
var source = new Source();
var dest = mapper.Map<Source, Dest>(source);
void Main()
var configurationStore = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.Mappers);
var mapper = new MappingEngine(configurationStore);
var server = new Server();
.CreateMap<From, To>()
.ForMember(d => d.ServerThing, m => m.MapFrom(s => s.ServerThingId))
public class DatabaseDeleter
private readonly ISessionFactory _configuration;
private static readonly string[] _ignoredTables = new[] { "sysdiagrams", /* DB Migration tables too */ };
private static string[] _tablesToDelete;
private static string _deleteSql;
private static object _lockObj = new object();
private static bool _initialized;
public DatabaseDeleter(ISessionFactory sessionSource)