Ejemplo n.º 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>();
        }