Exemple #1
0
        //使用ICO  AutoFac
        static void AutoFac()
        {
            ContainerBuilder bulider = new ContainerBuilder();
            //bulider.RegisterType<UserBll>().AsImplementedInterfaces();//
            //  bulider.RegisterType<DogBll>().AsImplementedInterfaces();//

            Assembly asm = Assembly.Load("MyBLLImpl");                    //加载这个类库中类

            bulider.RegisterAssemblyTypes(asm).AsImplementedInterfaces(); //

            var      container = bulider.Build();
            IUserBll bll       = container.Resolve <IUserBll>();

            bll.Addone("aaa", "23");


            IDogBll dogbll = container.Resolve <IDogBll>();

            dogbll.Bark();
        }