None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'ConcertRu.ApplicationsCore.Services.SessionWebAppService' can be invoked with the available services and parameters: Cannot resolve parameter 'System.Web.HttpContext httpContext' of constructor 'Void .ctor(System.Web.HttpContext)'. Cannot resolve parameter 'System.Web.HttpContextBase httpContext' of constructor 'Void .ctor(System.Web.HttpContextBase)'. Cannot resolve parameter 'ConcertRu.Infrastructure.Contracts.IConcertHttpContext httpContext' of constructor 'Void .ctor(ConcertRu.Model.Contracts.IConcertDb, ConcertRu.Infrastructure.Contracts.IConcertHttpContext)'.
// Create the container builder. var builder = new ContainerBuilder(); // Register the Web API controllers. builder.RegisterControllers(Assembly.GetExecutingAssembly()); // Register other dependencies. var services = typeof(AccessTokenService).Assembly; builder.Register(c => ConcertDb.Current).As<IConcertDb>().SingleInstance(); builder.RegisterAssemblyTypes(services) .Where(t => t.Name.EndsWith("Service")).AsImplementedInterfaces() .SingleInstance(); // Build the container. var container = builder.Build(); // Create the depenedency resolver. var resolver = new AutofacDependencyResolver(container); // Configure Web API with the dependency resolver. DependencyResolver.SetResolver(resolver);
public class SessionWebAppService : WebAppServiceBase, ISessionWebAppService { public SessionWebAppService(HttpContext httpContext) : this(new ConcertDb(), new WebFormContext(httpContext)) { } public SessionWebAppService(HttpContextBase httpContext) : this(new ConcertDb(), new MvcContext(httpContext)) { } public SessionWebAppService(IConcertDb concertDb, IConcertHttpContext httpContext) : base(concertDb, httpContext) { } ... }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)