Skip to content

Instantly share code, notes, and snippets.

public class EventPublisher : IEventPublisher
{
readonly ISubject<object> _subject = new Subject<object>();
IObservable<TEvent> GetEvent<TEvent>()
{
return _subject.AsObservable().OfType<TEvent>();
}
public void Publish<TEvent>(TEvent theEvent)
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
log4net:ERROR Could not create Appender [NHProfAppender] of type [HibernatingRhinos.Profiler.Appender.NHibernate.NHProfAppender, HibernatingRhinos.Profiler.Appender.NHibernateLog4Net]. Reported error follows.
System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMar
@hotgazpacho
hotgazpacho / gist:2999232
Created June 26, 2012 21:28
Query Classes
public interface IQuery<out TResult>
{
TResult Execute();
}
public abstract class Query<T> : IQuery<T>
{
public ISession Session { get; set; }
public abstract T Execute();
}
@hotgazpacho
hotgazpacho / gist:2998532
Created June 26, 2012 20:05
Composite ID restriction
public static class QueryOverExtensions
{
public static IQueryOver<TRoot, TSubType> WithComponent<TRoot, TSubType>(this IQueryOver<TRoot, TSubType> query, IProjection itemIdProjection, IProjection revNoProjection, Component component)
{
return component == null
? query
: query.WithComponentItem(itemIdProjection, component)
.WithComponentRevision(revNoProjection, component);
}
public class FindPotentiallyMatchingExamsForCompletionSignOffQuery : Query<IEnumerable<ExamResult>>
{
public override IEnumerable<ExamResult> Execute()
{
ExamResult er = null;
Component c = null;
VibrationPoint vp = null;
ExamMethod m = null;
var matchingCodeSectionIds = QueryOver.Of(() => er)
.Where(() => er.Surveillance.Id == Surveillance)
@hotgazpacho
hotgazpacho / gist:2311774
Created April 5, 2012 14:59
How do I write this as a detached criteria in NHibernate QueryOver syntax?
SELECT cc.ComponentTypeId
FROM ComponentControl cc
WHERE cc.ComponentTypeId = 0
OR cc.ComponentTypeId = (SELECT er.ComponentTypeId
FROM ExamResults er
WHERE er.ResultId = @id)
@hotgazpacho
hotgazpacho / ISessionSource.cs
Created March 31, 2012 03:25
ISessionSource
public interface ISessionSource
{
ISession CreateSession();
IStatelessSession CreateStatelessSession();
ISessionFactory SessionFactory { get; }
}
@hotgazpacho
hotgazpacho / gist:2001301
Created March 8, 2012 14:44
Mighty Moose exception
Could not find file 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Any'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName)
at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName)
at AutoTest.VS.Util.Navigation.TypeNavigation.GoToType(DTE2 application, String assembly, String typename)
at AutoTest.VS.ContinuousTests_ListOfRanTests.œ(String ass
@hotgazpacho
hotgazpacho / AddSurveillanceScheduleOverride.sql
Created December 13, 2011 19:02
Why does SQL Server complain about this?
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
C:\Users\iddwill> ipmo HyperV
Security Warning
Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your
computer. Do you want to run C:\Program Files\Modules\HyperV\hyperv.Format.ps1xml?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):