Ioc:Autofac Registration Concepts

Reflection Components

When using reflection-based components, Autofac automatically uses the constructor for your class with the most parameters that are able to be obtained from the container.

Instance Components

Something to consider when you register the instance is that Autofac automatically handles disposal of registered components and you may want to control the lifetime yourself rather than having Autofac call Disposeon your object for you. In that case, you need to register the instance with the ExternallyOwnedmethod.

Default Registrations

If more than one component exposes the same service, Autofac will use the last registered component as the default provider of that service.

 

posted on 2014-05-18 22:47  幸福框架  阅读(310)  评论(0编辑  收藏  举报

导航

我要啦免费统计