<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          BarbarianIOC簡單的 IoC 容器

          聯合創(chuàng)作 · 2023-09-30 07:09

          BarbarianIOC 是一個簡單的 .NET 實現的 IoC 容器,示例代碼:

          Container = new Container();
          int someMockAge = 23; // this could come from anywhere (App.Config / database etc etc)
          
          //Register ALL components
          container.RegisterComponents(
                  //where you can use concrete type
                  new Component().For<Foo>().WithInstanceMode(InstanceMode.Transient),
                  //or you can use an interface and it's implementation
                  new Component().For<IBaz>().ImplementedBy<Baz>().WithInstanceMode(InstanceMode.Transient),
                  //and you can also declare singleton instance mode if you like
                  new Component().For<SomeIBazDependantClass>().WithInstanceMode(InstanceMode.Singleton),
                  //and even supply some non IOC provided constructor params by way of an anonymous object
                  new Component().For<SomeFooDependantClass>()
                      .DependsOn(new 
                          { 
                              age=someMockAge
                          })
                      .WithInstanceMode(InstanceMode.Transient)
              );
                      
          //allow the container to wire stuff up (essentially create Expression.New for all 
          //components to allow Container to compile and create some quicker lookup delegates)
          container.WireUp();
          瀏覽 26
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  成人在线观看无码 | 中文字幕日本精品5 | 欧美操逼没码 | 男人天堂2024手机在线 | 五月激情四射网 |