Beispiel #1
0
        public virtual void AddComponent(Type type)
        {
            IComponentType annotation = GetComponentType(type);

            if (annotation == null)
            {
                throw new ArgumentException($"Type {type} does not provide component information.");
            }

            annotation.AddToModule(type, this);
        }
Beispiel #2
0
        public virtual void AddComponents(Func <Type, bool> filter = null, Assembly assembly = null)
        {
            if (assembly == null)
            {
                assembly = GetType().Assembly;
            }

            foreach (Type type in assembly.DefinedTypes)
            {
                IComponentType annotation = GetComponentType(type);
                if (annotation != null)
                {
                    if (filter(type))
                    {
                        annotation.AddToModule(type, this);
                    }
                }
            }
        }