Skip to content

Instantly share code, notes, and snippets.

public class WcfApplicationContext: IApplicationContext
{
private readonly IRepository<User> userRepository;
public WcfApplicationContext(IRepository<User> userRepository)
{
this.userRepository = userRepository;
}
public User CurrentUser
public class VirtualWcfPathProvider : VirtualPathProvider
{
public static readonly string VirtualWcfDirectoryName = "~/Services"; // Must start with "~/", must not end with "/".
private readonly IDictionary<string, Type> serviceMap;
public VirtualWcfPathProvider(IDictionary<string, Type> serviceMap)
{
this.serviceMap = serviceMap;
}
public class Ciselnik
{
public long Id{ get; set;}
public LocalizedText Name{ get; set;}
public IEnumerable<PolozkaCiselniku> Items { get; set; }
}
public class PolozkaCiselniku
{
public long Id{ get; set;}
using System;
using System.Drawing;
using System.IO;
using System.Text;
using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
namespace PNG.Net
{
public interface IPngStreamWriter
public delegate DateTime CurrentDateTimeDelegate();
public static class CurrentDateTime
{
public static readonly CurrentDateTimeDelegate DefaultDelegate = () => DateTime.Now;
}
public class ClassX
{
private CurrentDateTimeDelegate currentDateTime = CurrentDateTime.DefaultDelegate;
@Buthrakaur
Buthrakaur / gist:1014394
Created June 8, 2011 13:14
NH one-to-one
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using FluentNHibernate.Mapping;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
@Buthrakaur
Buthrakaur / gist:1442069
Created December 7, 2011 08:59
.NNET CF OBEX Service control
public static class NativeMethods
{
[DllImport("coredll")]
public extern static bool CloseHandle(IntPtr handle);
[DllImport("coredll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool DeviceIoControl(
IntPtr hDevice,
int dwIoControlCode,
[In] int[] inBuffer,
@Buthrakaur
Buthrakaur / gist:1613003
Created January 14, 2012 21:44
NHibernate QueryOver.List extension to support casting to anonymous types
public static IList<TRes> ListAs<TRes>(this IQueryOver qry, TRes resultByExample)
{
var ctor = typeof (TRes).GetConstructors().First();
return qry.UnderlyingCriteria
.SetResultTransformer(Transformers.AliasToBeanConstructor(ctor))
.List<TRes>();
}
[Fact]
public void ListAs_Should_CastQueryOverResultToTypeSameAsSupliedExampleInstance()
@Buthrakaur
Buthrakaur / gist:5747058
Created June 10, 2013 07:21
WindsorConfigurationTests
public class WindsorConfigurationTests
{
private readonly WindsorContainer container;
public WindsorConfigurationTests()
{
container = new WindsorContainer();
container.Install(FromAssembly.Named("AppX"));
}
public class OracleManagedDataClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider
{
private const string driverAssemblyName = "Oracle.ManagedDataAccess";
private const string connectionTypeName = "Oracle.ManagedDataAccess.Client.OracleConnection";
private const string commandTypeName = "Oracle.ManagedDataAccess.Client.OracleCommand";
private static readonly SqlType GuidSqlType = new SqlType(DbType.Binary, 16);
private readonly PropertyInfo oracleCommandBindByName;
private readonly PropertyInfo oracleDbType;
private readonly object oracleDbTypeRefCursor;