I have a library with class, DraftEngine.cs, and within DraftEngine.cs, I have a RegisterDependencies. Updating Microsoft.AspNet.Mvc to the latest package, 6.0, DependencyResolver does not exist, as it is part of System.Web.Mvc.
protected virtual void RegisterDependencies(DraftConfig config) { var builder = new ContainerBuilder(); var container = builder.Build(); _containerManager = new ContainerManager(container); var typeFinder = new WebAppTypeFinder(); builder = new ContainerBuilder(); builder.RegisterInstance(config).As<DraftConfig>().SingleInstance(); builder.RegisterInstance(this).As<IEngine>().SingleInstance(); builder.RegisterInstance(typeFinder).As<ITypeFinder>().SingleInstance(); builder.Update(container); builder = new ContainerBuilder(); var drTypes = typeFinder.FindClassesOfType<IDependencyRegistrar>(); var drInstances = new List<IDependencyRegistrar>(); foreach (var drType in drTypes) drInstances.Add((IDependencyRegistrar)Activator.CreateInstance(drType)); drInstances = drInstances.AsQueryable().OrderBy(t => t.Order).ToList(); foreach (var dependencyRegistrar in drInstances) dependencyRegistrar.Register(builder, typeFinder, config); builder.Update(container);DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); }
I have combed through the Dependency Injection article but couldn't find a fix to the problem, or maybe I missed something. Any help would be greatly appreciated.