Skip to content

Instantly share code, notes, and snippets.

@toddpi314
Created July 30, 2012 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddpi314/3202710 to your computer and use it in GitHub Desktop.
Save toddpi314/3202710 to your computer and use it in GitHub Desktop.
Lightning_DependencyResolver
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using LightningMVC.Common.Container;
using LightningMVC.Services;
namespace LightningMVC.Code
{
public class CustomDependencyResolver : IDependencyResolver
{
static CustomDependencyResolver()
{
// setup the container
IoC.Instance = new ContainerManager();
IoC.Init(new Assembly[] {
typeof(IDataProvider).Assembly
});
}
#region IDependencyResolver Members
public object GetService(Type serviceType)
{
return IoC.Instance.TryGet(serviceType);
}
public IEnumerable<object> GetServices(Type serviceType)
{
return IoC.Instance.GetAll(serviceType);
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment