示例#1
0
        public void Install(WindsorContainer container, IMapper mapper)
        {
            container.Register(Component.For <IInitProject>().ImplementedBy <InitProjectImp>().LifestyleSingleton());

            var appSetting = IoC.Resolve <IAppSetting>();
            var test       = RPCTransmitter <ITestClass> .Register(appSetting.GetSetting("RPCTestClass"));

            container.Register(Component.For <ITestClass>().Instance(test).LifestyleSingleton());

            var qs   = appSetting.Get <List <QSettingModel> >("QueueSettings");
            var item = qs.FirstOrDefault(q => q.Name == "WebTestClass");

            container.AddWebReceiverService <WebTestReceiver>(item);
            item = qs.FirstOrDefault(q => q.Name == "RPCTestClass");
            container.AddRpcReceiverService <RpcTestReceiver>(item);

            mapper.Bind <SourceModel, DestModel>()
            .Map(d => d.RandNum, s => new Random().Next(1000));

            var src = new SourceModel()
            {
                Name = "Hello",
                Id   = 100
            };

            var des = src.MapTo <DestModel>();
        }
示例#2
0
        public void Install(WindsorContainer container, IMapper mapper)
        {
            //container.Register(Component.For<IInitProject>().ImplementedBy<InitProjectImp>().LifestyleSingleton());

            var appSetting = IoC.Resolve <IAppSetting>();

            var item = appSetting.GetQSetting("RPCTestClass");

            container.AddRpcReceiverService <RpcTestReceiver>(item);


            var test = RPCTransmitter <ITestClass> .Register(appSetting.GetQSetting("RPCTestClass"));

            container.Register(Component.For <ITestClass>().Instance(test).LifestyleSingleton());
        }