public void Scan()
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(e => !e.IsDynamic).Except(new[] { Assembly.GetExecutingAssembly() }).ToList();

            foreach (var assembly in assemblies)
            {
                var exportedTypes = new Type[0];
                try
                {
                    exportedTypes = assembly.GetExportedTypes();
                }
                catch { }

                foreach (var type in exportedTypes)
                {
                    if (rules.IsAnEvent(type))
                    {
                        EventFullNameToTypeMap.Add(type.FullName, type);
                        EventTypeToFullNameMap.Add(type, type.FullName);
                    }
                    else if (rules.IsACommand(type))
                    {
                        CommandFullNameToTypeMap.Add(type.FullName, type);
                        CommandTypeToFullNameMap.Add(type, type.FullName);
                    }
                }
            }
        }
Exemple #2
0
 public void Scan()
 {
     foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().Except(new[] { Assembly.GetExecutingAssembly() }))
     {
         foreach (var type in assembly.GetTypes())
         {
             if (rules.IsAnEvent(type))
             {
                 eventTypes.Add(type);
             }
             if (rules.IsACommand(type))
             {
                 commandTypes.Add(type);
             }
         }
     }
 }
        public void Scan()
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(e => !e.IsDynamic).Except(new[] { Assembly.GetExecutingAssembly() }).ToList();

            foreach (var assembly in assemblies)
            {
                foreach (var type in assembly.GetExportedTypes())
                {
                    if (rules.IsAnEvent(type))
                    {
                        eventTypes.Add(type);
                    }
                    if (rules.IsACommand(type))
                    {
                        commandTypes.Add(type);
                    }
                }
            }
        }