コード例 #1
0
ファイル: PluginGraph.cs プロジェクト: mtscout6/structuremap
        public void ImportRegistry(Type type)
        {
            if (Registries.Any(x => x.GetType() == type))
            {
                return;
            }

            var registry = (Registry)Activator.CreateInstance(type);

            registry.ConfigurePluginGraph(this);
        }
コード例 #2
0
        public override void EnsureSeeded()
        {
            if (!Registries.Any())
            {
                var data = SeedDataReader.ReadCsv <Registry>(typeof(RegistryContext).Assembly);
                AddRange(data);
            }

            if (!ExtractRequests.Any())
            {
                var data = SeedDataReader.ReadCsv <ExtractRequest>(typeof(RegistryContext).Assembly);
                AddRange(data);
            }
            SaveChanges();
        }
コード例 #3
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)
        {
            if (Registries.Any(x => x.GetType() == type) || QueuedRegistries.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);
            }


            //registry.As<IPluginGraphConfiguration>().Configure(this);
        }