Ioc:The basic pattern for integrating Autofac into your application

The basic pattern for integrating Autofac into your application is:

  • Structure your app with inversion of control (IoC) in mind.
  • Add Autofac references.
  • At application startup...
  • Create a ContainerBuilder.
  • Register components.
  • Build the container and store it for later use.
  • During application execution...
  • Create a lifetime scope from the container.
  • Use the lifetime scope to resolve instances of the components.

posted on 2014-05-16 21:34  幸福框架  阅读(183)  评论(0编辑  收藏  举报

导航

我要啦免费统计