Пример #1
0
        static void ConfigureChannels()
        {
            var channelFactory = new ChannelFactory();

            foreach (
                var type in
                    Configure.TypesToScan.Where(t => typeof (IChannelReceiver).IsAssignableFrom(t) && !t.IsInterface))
                channelFactory.RegisterReceiver(type);

            foreach (
                var type in
                    Configure.TypesToScan.Where(t => typeof (IChannelSender).IsAssignableFrom(t) && !t.IsInterface))
                channelFactory.RegisterSender(type);

            Configure.Instance.Configurer.RegisterSingleton<IChannelFactory>(channelFactory);
        }
Пример #2
0
        static void ConfigureChannels(FeatureConfigurationContext context)
        {
            var channelFactory = new ChannelFactory();

            foreach (
                var type in
                    context.Settings.GetAvailableTypes().Where(t => typeof(IChannelReceiver).IsAssignableFrom(t) && !t.IsInterface))
            {
                channelFactory.RegisterReceiver(type);
            }

            foreach (
                var type in
                    context.Settings.GetAvailableTypes().Where(t => typeof(IChannelSender).IsAssignableFrom(t) && !t.IsInterface))
            {
                channelFactory.RegisterSender(type);
            }

            context.Container.RegisterSingleton<IChannelFactory>(channelFactory);
        }