IsAggregateRoot() public static method

判断给定类型是否是聚合根
public static IsAggregateRoot ( Type type ) : bool
type System.Type
return bool
 public void RegisterAllAggregateRootTypesInAssemblies(params Assembly[] assemblies)
 {
     foreach (var assembly in assemblies)
     {
         _aggregateRootTypeList.AddRange(assembly.GetTypes().Where(t => TypeUtils.IsAggregateRoot(t)));
     }
 }
        /// <summary>
        /// 从给定程序集中根据给定的特性扫描所有类型与其名称的映射关系;
        /// </summary>
        public void RegisterAllTypeNameMappings <T>(NameTypeMappingType mappingType, params Assembly[] assemblies) where T : AbstractTypeNameAttribute
        {
            Type typeNameAttributeType = typeof(T);

            foreach (var assembly in assemblies)
            {
                foreach (var type in assembly.GetTypes().Where(x => x.GetCustomAttributes(typeNameAttributeType, false).Count() > 0))
                {
                    var attribute = type.GetCustomAttributes(typeNameAttributeType, false).Single() as AbstractTypeNameAttribute;
                    RegisterMapping(attribute.MappingType, attribute.Name, type);
                }
            }

            foreach (var assembly in assemblies)
            {
                if (mappingType == NameTypeMappingType.AggregateRootMapping)
                {
                    foreach (var type in assembly.GetTypes().Where(x => TypeUtils.IsAggregateRoot(x)))
                    {
                        if (!IsTypeExist(mappingType, type))
                        {
                            RegisterMapping(mappingType, type.FullName, type);
                        }
                    }
                }
                else if (mappingType == NameTypeMappingType.EventMapping)
                {
                    foreach (var type in assembly.GetTypes().Where(x => TypeUtils.IsEvent(x)))
                    {
                        if (!IsTypeExist(mappingType, type))
                        {
                            RegisterMapping(mappingType, type.FullName, type);
                        }
                    }
                }
                else if (mappingType == NameTypeMappingType.SnapshotMapping)
                {
                    foreach (var type in assembly.GetTypes().Where(x => TypeUtils.IsSnapshot(x)))
                    {
                        if (!IsTypeExist(mappingType, type))
                        {
                            RegisterMapping(mappingType, type.FullName, type);
                        }
                    }
                }
            }
        }
        public void RegisterInternalHandlers(params Assembly[] assemblies)
        {
            var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly;

            foreach (var assembly in assemblies)
            {
                foreach (var aggregateRootType in assembly.GetTypes().Where(t => TypeUtils.IsAggregateRoot(t)))
                {
                    var entries = from method in aggregateRootType.GetMethods(bindingFlags)
                                  let parameters = method.GetParameters()
                                                   where (method.Name == "Handle" || method.Name.StartsWith("On")) && parameters.Length == 1
                                                   select new { Method = method, EventType = parameters.First().ParameterType };

                    foreach (var entry in entries)
                    {
                        RegisterInternalHandler(aggregateRootType, entry.EventType, entry.Method);
                    }
                }
            }
        }
        public void RegisterAllEventCallbackMetaDataInAssemblies(params Assembly[] assemblies)
        {
            foreach (var assembly in assemblies)
            {
                foreach (var type in assembly.GetTypes().Where(t => TypeUtils.IsAggregateRoot(t)))
                {
                    var methodNameMatchPattern = "^(on|On|ON|oN)+";
                    var methodEntries          = from method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)
                                                 let parameters = method.GetParameters()
                                                                  where
                                                                  Regex.IsMatch(method.Name, methodNameMatchPattern, RegexOptions.CultureInvariant) &&
                                                                  parameters.Length == 1
                                                                  select new { Method = method, EventType = parameters.First().ParameterType };

                    foreach (var methodEntry in methodEntries)
                    {
                        RegisterCallbackMetaData(new CallbackKey(type, methodEntry.EventType), methodEntry.Method);
                    }
                }
            }
        }
 public void RegisterMappings(NameTypeMappingType mappingType, params Assembly[] assemblies)
 {
     foreach (var assembly in assemblies)
     {
         if (mappingType == NameTypeMappingType.AggregateRootMapping)
         {
             foreach (var type in assembly.GetTypes().Where(x => TypeUtils.IsAggregateRoot(x)))
             {
                 if (!IsTypeExist(mappingType, type))
                 {
                     RegisterMapping(mappingType, type.FullName, type);
                 }
             }
         }
         else if (mappingType == NameTypeMappingType.SourcableEventMapping)
         {
             foreach (var type in assembly.GetTypes().Where(x => _eventTypeProvider.IsSourcableEvent(x)))
             {
                 if (!IsTypeExist(mappingType, type))
                 {
                     RegisterMapping(mappingType, type.FullName, type);
                 }
             }
         }
         else if (mappingType == NameTypeMappingType.SnapshotMapping)
         {
             foreach (var type in assembly.GetTypes().Where(x => _snapshotTypeProvider.IsSnapshot(x)))
             {
                 if (!IsTypeExist(mappingType, type))
                 {
                     RegisterMapping(mappingType, type.FullName, type);
                 }
             }
         }
     }
 }