• Ninject Lazy Load


    namespace LayzyLoadTest
    {
        [TestClass]
        public class UnitTest1
        {
    
    
            private IKernel InitKernel()
            {
                Ninject.IKernel kernel = new Ninject.StandardKernel(new LazyBinding());
    
                //kernel.Load<LazyBinding>();
    
                kernel.Bind<IPerson>().To<Father>();
                kernel.Bind<IVehicle>().To<Car>();
    
                kernel.Bind<IPlace>().To<Road>().Named("comm");
                kernel.Bind<IPlace>().To<LazyRoad>().Named("lazy");
    
                return kernel;
            }
    
            [TestMethod]
            public void TestMethod1()
            {
    
    
    
                var comm = InitKernel().Get<IPlace>("comm");
    
                comm.CurSpeed();
                comm.ShowSpeed();
    
                //Console.WriteLine("------------------------------------------------");
    
                //var lazy = kernel.Get<IPlace>("lazy");
    
                ////lazy.CurSpeed();
                ////lazy.ShowSpeed();
    
    
    
            }
    
    image
     
     
            [TestMethod]
            public void Lazy()
            {
    
    
                var lazy = InitKernel().Get<IPlace>("lazy");
    
                lazy.CurSpeed();
    
                Console.WriteLine("----over curspeed--------------------");
    
                lazy.ShowSpeed();
            }
        }
    }
    

    image



  • 相关阅读:
    Fiddler 捕获HTTPS流量
    Fiddler 弱网测试
    Fiddler Composer设计器, Fitter过滤器,断点
    Fiddler Statistics统计,Inspector检查器,AutoResponder自动响应器
    Fiddler Session List会话列表、命令行与状态栏
    Fiddler菜单栏工具栏
    HTTP协议请求与响应详解
    Postman 运用Cookie
    Postman 文件上传请求
    Postman 头域操作
  • 原文地址:https://www.cnblogs.com/zbw911/p/3173608.html
Copyright © 2020-2023  润新知