温莎城堡有没有什么缺点? [英] Castle Windsor are there any downsides?

查看:110
本文介绍了温莎城堡有没有什么缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找到城堡项目和具体温莎。我已经与什么是可能的这种技术和具有这样的松耦合系统的好处是绝对明显pssed这样的IM $ P $。我不确定的唯一的事情是,如果采用这种方法有什么缺点,特别是在asp.net?例如性能命中,等等。

我试图使这种方法我的同胞开发商在这里看到的好处,我被击中以下的回击:


  1. 这是使用反射,每一个对象从容器调用时,反射必须使用,因此性能将是可怕的。 (这种情况?它使用反射在每次调用?)


  2. 如果我依靠接口;我该如何处理有已上涨到阶级额外的方法和属性的对象? (通过继承)



解决方案

要回答你的问题:


  

      
  1. 这是利用反射和各
      ,一个下贱从调用时
      容器,必须反思这样用
      表现将是可怕的。 (这是
      案子?它使用反思
      每一个电话?)

  2.   


  • 不,不。大多数时候,当你注册组件使用的小反射。同时生成代理类型,你第一次从容器要求组件也可以使用反射。


  <醇开始=2>
  
  • 如果我依靠接口;怎么样
      我处理有额外的对象
      这已经方法和属性
      上涨到类? (通过
      继承)

  •   

    • 这是设计的所有问题。你不想让每个和由容器创建的每个对象。您可以使用它主要用于服务依存关系。在这种情况下,你不关心什么类型实际上是躲在背后的接口(这是它的整点,不是吗?)。

    您也可以有类组件,但他们有局限性,你必须知道的那些(例如你不能拦截非虚方法的调用)的。我发现温莎是最成熟,最适合我的发展集装箱。

    风格

    除此之外,性能,我没有听说过一个项目,该项目不得不放弃,因为无法接受的性能依赖容器。温莎很聪明吧,所以你不必支付两倍的价格它缓存长时间操作的结果。
    你可以在互联网上找到的图表,许多IoC容器中,进行比较的速度。有两点需要注意那些:所有容器都非常快。
    不要以为一个事实,即其他容器都在这些图,温莎更快,这意味着他们是更好的。温莎做了很多的东西给你,其他的容器没有。

    I have been looking into the Castle project and specifically Windsor. I have been so impressed with what is possible with this technology and the benefits of having a such a loosely coupled system are definitely apparent. The only thing I am unsure of is if using this method has any downsides, specifically in asp.net? for example performance hits, etc.

    I am trying to make the benefits of this approach visible to my fellow developers here and am being hit with the following comebacks:

    1. That is using reflection and each time that an object is called from the container, reflection must used so performance will be terrible. (Is this the case? does it use reflection on every call?)

    2. If I am relying on Interfaces; how do I deal with objects that have extra methods and properties which have been tacked onto the class? (through inheritance)

    解决方案

    To answer your questions:

    1. That is using reflection and each time that an abject is called from the container, reflection must used so performance will be terrible. (Is this the case? does it use reflection on every call?)

    • No, it does not. Most of the time it uses little reflection when you register the component. It may also use reflection while generating proxy type, first time you request a component from the container.

    1. If I am relying on Interfaces; how do I deal with objects that have extra methods and properties which have been tacked onto the class? (through inheritance)

    • It's all a matter of design. You don't want to have each and every object created by the container. You use it primarily for service dependencies. In this case, you don't care about what type is actually hiding behind the interface (that's the whole point of it, isn't it?).

    You also can have class components, but they have limitations, and you must be aware of those (for example you can't intercept calls to non-virtual methods). I have found Windsor to be the most mature, and best suited to my style of development container of all.

    Other than that, Performance, I haven't heard of a project that had to discard dependency container because of unacceptable performance. Windsor is really smart about it, and it caches the results of lengthy operations so that you don't have to pay the price twice. You may find charts on the Internet, comparing speed of many IoC containers. Two things to note about those: All containers are really fast. Don't think that the fact that other containers are faster on these charts than Windsor, means that they are better. Windsor does a lot of stuff for you that other containers don't.

    这篇关于温莎城堡有没有什么缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆