예제 #1
0
        /// <summary>
        /// Searchs an Assembly for registrable Services
        /// </summary>
        /// <param name="assembly">The Assembly that will be part of the search.</param>
        public void ScanAssembly(Assembly assembly)
        {
            if (Assemblies.Contains(assembly))
            {
                return;
            }

            Assemblies.Add(assembly);

            var contextMappings       = assembly.MapTypes <IContext>();
            var serviceMappings       = assembly.MapTypes <IService>();
            var sharedServiceMappings = assembly.MapTypes <ISharedService>();
            var instanceTypes         = assembly.FindInterfaces <IInstance>();
            var factoryTypes          = assembly.FindInterfaces <IFactory>(true);
            var descriptorMappings    = assembly.MapGenericTypes <IModelDescriptor>(true);

            Contexts.AddRange(contextMappings);
            Services.AddRange(serviceMappings);
            SharedServices.AddRange(sharedServiceMappings);
            Instances.AddRange(instanceTypes);
            Factories.AddRange(factoryTypes);
            Descriptors.AddRange(descriptorMappings);
        }
예제 #2
0
 /// <summary>Add explicit instances</summary>
 public Plugins <TInterface> Add(IEnumerable <TInterface> inst)
 {
     Instances.AddRange(inst);
     return(this);
 }
예제 #3
0
 public void AddInstances(IEnumerable <GGrassInstance> newInstances)
 {
     Instances.AddRange(newInstances);
     RecalculateBounds();
     Changed();
 }