Пример #1
0
        public void ImportRegistry(Registry registry)
        {
            var all = Registries.Concat(QueuedRegistries).ToArray();

            if (Registry.RegistryExists(all, registry))
            {
                return;
            }


            QueuedRegistries.Enqueue(registry);
        }
Пример #2
0
        /// <summary>
        /// Adds a Registry by type.  Requires that the Registry class have a no argument
        /// public constructor
        /// </summary>
        /// <param name="type"></param>
        public void ImportRegistry(Type type)
        {
            var all = Registries.Concat(QueuedRegistries);

            if (all.Any(x => x.GetType() == type))
            {
                return;
            }

            try
            {
                var registry = (Registry)Activator.CreateInstance(type);
                QueuedRegistries.Enqueue(registry);
            }
            catch (Exception e)
            {
                throw new StructureMapException(
                          "Unable to create an instance for Registry type '{0}'.  Please check the inner exception for details"
                          .ToFormat(type.GetFullName()), e);
            }
        }