Created
July 30, 2012 00:02
-
-
Save toddpi314/3202710 to your computer and use it in GitHub Desktop.
Lightning_DependencyResolver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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