麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

Autofac創建實例的方法總結[轉]

2019-11-17 02:55:54
字體:
來源:轉載
供稿:網友

Autofac創建實例的方法總結[轉]

1、InstancePerDependency

對每一個依賴或每一次調用創建一個新的唯一的實例。這也是默認的創建實例的方式。

官方文檔解釋:Configure the component so that every dependent component or call to Resolve() gets a new, unique instance (default.)

2、InstancePerLifetimeScope

在一個生命周期域中,每一個依賴或調用創建一個單一的共享的實例,且每一個不同的生命周期域,實例是唯一的,不共享的。

官方文檔解釋:Configure the component so that every dependent component or call to Resolve() within a single ILifetimeScope gets the same, shared instance. Dependent components in different lifetime scopes will get different instances.

3、InstancePerMatchingLifetimeScope

在一個做標識的生命周期域中,每一個依賴或調用創建一個單一的共享的實例。打了標識了的生命周期域中的子標識域中可以共享父級域中的實例。若在整個繼承層次中沒有找到打標識的生命周期域,則會拋出異常:DependencyResolutionException。

官方文檔解釋:Configure the component so that every dependent component or call to Resolve() within a ILifetimeScope tagged with any of the PRovided tags value gets the same, shared instance. Dependent components in lifetime scopes that are children of the tagged scope will share the parent's instance. If no appropriately tagged scope can be found in the hierarchy anDependencyResolutionExceptionis thrown.

4、InstancePerOwned

在一個生命周期域中所擁有的實例創建的生命周期中,每一個依賴組件或調用Resolve()方法創建一個單一的共享的實例,并且子生命周期域共享父生命周期域中的實例。若在繼承層級中沒有發現合適的擁有子實例的生命周期域,則拋出異常:DependencyResolutionException。

官方文檔解釋:Configure the component so that every dependent component or call to Resolve() within a ILifetimeScope created by an owned instance gets the same, shared instance. Dependent components in lifetime scopes that are children of the owned instance scope will share the parent's instance. If no appropriate owned instance scope can be found in the hierarchy anDependencyResolutionExceptionis thrown.

5、SingleInstance

每一次依賴組件或調用Resolve()方法都會得到一個相同的共享的實例。其實就是單例模式。

官方文檔解釋:Configure the component so that every dependent component or call to Resolve() gets the same, shared instance.

6、InstancePerHttpRequest

在一次Http請求上下文中,共享一個組件實例。僅適用于asp.net mvc開發。

官方文檔解釋:Share one instance of the component within the context of a single HTTP request.

轉載自:http://blog.csdn.net/dhx20022889/article/details/9061483


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美成人一级 | 午夜精品福利影院 | 国产刺激高潮av | 最新黄色毛片 | 91av久久| 竹内纱里奈和大战黑人 | 欧美视频在线一区二区三区 | 在线成人影视 | 日韩一级精品 | 91久久国产露脸精品国产护士 | 久久中文一区 | 欧美a在线看 | 久久亚洲精选 | 黄色av一区二区三区 | av电影在线网 | 国产成人综合在线观看 | 九色新网址 | julieann艳星激情办公室 | 国产精品久久久久久久久久10秀 | 国产毛片在线高清视频 | 一区二区三区视频在线观看 | 91网站免费观看 | 亚洲综合无码一区二区 | 99爱在线免费观看 | 小情侣嗯啊哦视频www | 空姐一级毛片 | 欧美a级在线免费观看 | 久久久一区二区三区视频 | 色综合久久久久久 | 国产一区二区视频精品 | 一边吃奶一边摸下娇喘 | 中文字幕欧美专区 | 国产精品国产三级国产在线观看 | 99国内精品视频 | 成年免费观看视频 | av手机在线电影 | 日韩中字在线 | 深夜小视频在线观看 | 亚洲欧美不卡视频 | 久久999精品久久久 国产噜噜噜噜久久久久久久久 | 美国黄色毛片女人性生活片 |