castle windsor学习----- CastleComponentAttribute 特性注册

[CastleComponent("GenericRepository", typeof(IRepository<>), Lifestyle = LifestyleType.Transient)]
public class Repository<T> : IRepository, IRepository<T>
{
    // some implementation
}
container.Register(AllTypes.FromThisAssembly()
    .Pick()
    .If(Component.IsCastleComponent));

 

posted @ 2017-03-12 10:40  蓝平凡  阅读(346)  评论(0编辑  收藏  举报