When we inject IWorkContext in WebStoreContext its gives error

一笑奈何 提交于 2019-12-21 20:57:04

问题


I am trying to inject IWorkContext in WebStoreContext or StoreService.

but when we run the project it give's errors.

Error on ContainerManager.cs(line no 113)

An unhandled exception of type 'System.StackOverflowException' occurred in Autofac.dll

example

private readonly IWorkContext _workContext = EngineContext.Current.Resolve<IWorkContext>();

Or

private readonly IWorkContext _workContext;

public ctor(IWorkContext workContex)
{
    this._workContex = workContext;
}

回答1:


Circular references are not allowed. WorkContext already depends on IStoreContext. You cannot make StoreContext already depends on IWorkContext.



来源:https://stackoverflow.com/questions/24566962/when-we-inject-iworkcontext-in-webstorecontext-its-gives-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!