the question is pretty straightforward.i want to access overall AutoFac
container so that i can register my dependency in it.
remark:
i am not OK with inheriting from IDependency
cause in my project it results in a circular referencing (of two assemblies).what i wanna do is register a component with a Key and access it with same Key in other assembly. thanks in advance.
EDIT:
i have found a class called DefaultOrchardHostContainer
in the core ,but it only exposes Resolve<>
method but not Register()
.
You can add an Autofac module directly to your Orchard module and Orchard will pick it up. ex...
public class MyModule : Module {
protected override void Load(ContainerBuilder builder){
builder.RegisterType<MyDependency>().As<IMyDependency>().InstancePerDependency();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.