惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
爱范儿
爱范儿
The Cloudflare Blog
腾讯CDC
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
C
Check Point Blog
Schneier on Security
Schneier on Security
S
Schneier on Security
J
Java Code Geeks
B
Blog RSS Feed
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
博客园_首页
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
A
About on SuperTechFans
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
A
Arctic Wolf
S
Secure Thoughts
P
Palo Alto Networks Blog
The Last Watchdog
The Last Watchdog
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 三生石上(FineUI控件)
D
Darknet – Hacking Tools, Hacker News & Cyber Security
量子位
U
Unit 42
I
InfoQ
D
DataBreaches.Net
P
Privacy International News Feed
T
Troy Hunt's Blog
博客园 - 叶小钗
T
Threatpost
博客园 - Franky
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
www.infosecurity-magazine.com
www.infosecurity-magazine.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cisco Blogs

博客园 - 福娃

Ubuntu 16.04 LTS更新 程序员如何走出迷茫的困境? PHP vs Python Apache2.4中开通HTTP基本认证 NPM 与 left-pad 事件:我们是不是早已忘记该如何好好地编程? Groovy split竖杆注意 使用Flask-Migrate进行管理数据库升级 Fabric自动部署太方便了 程序员的复仇:11行代码如何让Node.js社区鸡飞狗跳 CAS认证原理图 grails 私有库相关设置 A successful Git branching model String to Date 多种格式转换 IBatis.Net如何支持多个数据库 [django]the story about Django and TurboGears [django]newforms两种方式示例 Since NHibernate 1.2.0, objects are lazy by default - 福娃 [Castle]Castle.Model被Castle.Core代替了 [Castle]Asp.Net中获取Castle容器中的服务的另一方法
[Castle]Castle也范型 - 福娃 - 博客园
福娃 · 2006-12-11 · via 博客园 - 福娃

配置文件如下:

<!-- Core data access services -->
        
<component 
            
id="commondao" 
            service
="RXOA.DataAccess.ICommonDao`1,RXOA.DataAccess"
            type
="RXOA.DataAccess.CommonDao`1,RXOA.DataAccess">
        
</component>

上面这种是一种通用的配置方法,也就是说这种配置可以使用任何类型如:

private ICommonDao<Announce> _commonDao;
        
private ICommonDao<AnnounceType> _typecommonDao;
        
private ICommonDao<ObjectLooker> _objDao;


        
public AnnounceService(ICommonDao<Announce> commonDao, ICommonDao<AnnounceType> typecommonDao,
                               ICommonDao
<ObjectLooker> objDao)
        
{
            
this._commonDao = commonDao;
            
this._typecommonDao = typecommonDao;
            
this._objDao = objDao;
        }

这里有三种不同的类型,只需上面一个配置即可。
你也可以配置制定类型的范型服务

<component 
    
id='int.repos.generic' 
    
service='Namespace.IRepository`1[[System.Int32]], AssemblyName' 
    type
='Namespace.Repository`1[[System.Int32]], AssemblyName' />

更多参考Castle Documention
http://www.castleproject.org/container/documentation/v1rc3/usersguide/genericssupport.html