简体   繁体   English

Autofac:获取通过扫描创建的注册

[英]Autofac: Get registration created by scanning

I saw a couple of similar questions but no exact answer. 我看到了几个类似的问题,但没有确切的答案。

If I scan an assembly: 如果我扫描装配体:

containerBuilder.RegisterAssemblyTypes(...)

Can I then tweak the registration of a specific type that was registered this way?, ie: 然后可以调整通过这种方式注册的特定类型的注册吗,即:

containerBuilder.RegisterAssemblyTypes(...)
containerBuilder.GetRegistration<MyType>().WithParameter("param", paramValue);

Is there a way to achieve something of this sort with Autofac? 有没有办法用Autofac实现这种目的?

You can use Except() method to exclude types from scanning, then you can register your special types by hand. 您可以使用Except()方法从扫描中排除类型,然后可以手动注册特殊类型。 More info on Autofac wiki . 有关Autofac Wiki的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM