예제 #1
0
파일: Form1.cs 프로젝트: vic-p/RemotingDemo
        private void button1_Click(object sender, EventArgs e)
        {
            ITest1 test1 = PMY.Remoting.Common.RemotingObjFactory.Test1;
            ITest2 test2 = PMY.Remoting.Common.RemotingObjFactory.Test2;

            MessageBox.Show(test1.Test());
            MessageBox.Show(test2.Test());
        }
예제 #2
0
 static void Main(string[] args)
 {
     var dual = new Dual();
     ITest test = dual;
     test.Test();
     ITest2 test2 = dual;
     test2.Test();
     Console.ReadLine();
 }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            ContainerBuilder builder = new ContainerBuilder();

            builder.RegisterType <Test>().As <ITest1>().InstancePerLifetimeScope();
            builder.RegisterType <Test2>().As <ITest2>().InstancePerLifetimeScope();
            var container = builder.Build();

            //       ITest1 t = container.Resolve<ITest1>();
            Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
            ITest2 t2 = container.Resolve <ITest2>();

            Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
            t2.Test();
            Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
            Console.Read();
        }