Beispiel #1
0
        public BusMessages(MessageScanRules messageScanRules, IDependencyResolver dependencyResolver)
        {
            var scanner = new MessageScanner(messageScanRules);

            scanner.Scan();

            if (!scanner.EventTypes.Any() && !scanner.CommandTypes.Any())
            {
                throw new TypeLoadException("Unable to find any messages. Properly define the message scan rules so it can be scanned properly.");
            }

            if (dependencyResolver == null)
            {
                InitializeMapsWithoutDependencyResolver(scanner);
            }
            else
            {
                InitializeMapsWithDependencyResolver(dependencyResolver, scanner);
            }
        }
Beispiel #2
0
        public BusMessages(MessageScanRules messageScanRules)
        {
            var scanner = new MessageScanner(messageScanRules);

            scanner.Scan();

            var eventTypes = scanner.EventTypes;

            nameToMessageTypeEventMap = eventTypes.ToDictionary(e => e.FullName);
            messageTypeToNameEventMap = eventTypes.ToDictionary(e => e, e => e.FullName);

            var commandTypes = scanner.CommandTypes;

            nameToMessageTypeCommandMap = commandTypes.ToDictionary(e => e.FullName);
            messageTypeToNameCommandMap = commandTypes.ToDictionary(e => e, e => e.FullName);

            if (!eventTypes.Any() && !commandTypes.Any())
            {
                throw new TypeLoadException("Unable to find any messages. Properly define the message scan rules so it can be scanned properly.");
            }
        }
Beispiel #3
0
 public MessageScanner(MessageScanRules rules)
 {
     this.rules = rules;
 }