Skip to content

Instantly share code, notes, and snippets.

@Itslet
Itslet / Global.asax.cs
Created October 31, 2010 08:47
Fluent Nhibernate session per request
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Context;
using System;
namespace CastleDemo.Infrastructure
{
public interface IStoryTeller
{
string GoodMorning();
}
}
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Castle.MicroKernel.SubSystems.Configuration;
using CastleDemo.Infrastructure;
namespace CastleDemo.Installers
{
public class StoryTellerInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
public class HomeController : Controller
{
//
// GET: /Home/
public ILogger Logger { get; set; }
private readonly IStoryTeller _teller;
public HomeController(IStoryTeller teller)
{
_teller = teller;
using Castle.Windsor;
using Castle.Windsor.Installer;
using CastleDemo.Plumbing;
using Castle.MicroKernel.Registration;
namespace CastleDemo
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Castle.MicroKernel.SubSystems.Configuration;
using System.Web.Mvc;
using CastleDemo.Controllers;
using Castle;
using Castle.MicroKernel;
using System.Web.Mvc;
using System.Web.Routing;
namespace CastleDemo.Plumbing
{
public class WindsorControllerFactory : DefaultControllerFactory
{
private readonly IKernel kernel;
@Itslet
Itslet / ISession.cs
Created January 9, 2011 21:41
Unit of Work
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Web.Infrastructure
{
public interface ISession:IDisposable {
void CommitChanges();
Db4objects.Db4o.IObjectContainer Container { get; }
@Itslet
Itslet / Db4oSession.cs
Created January 9, 2011 21:42
Unit of Work for Db4o
using Db4objects.Db4o;
using System.Linq;
using Db4objects.Db4o.Linq;
using System.Web;
using System.IO;
using System;
using System.Collections.Generic;
namespace Web.Infrastructure
{
@Itslet
Itslet / VirtualServer.cs
Created January 9, 2011 21:23
Inventory Model
namespace Core
{
public class BladeServer
{
public string Hostname { get; set;}
public string ServerRole { get; set; }
public string IPAddress { get; set; }
public string OS { get; set; }
public BladeChassis BladeChassis { get; set; }