コード例 #1
0
        public ItemIndexFactory GetFactory(string profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }

            // build the container for seeders
            Assembly[] indexAssemblies = new[]
            {
                // Cadmus.Index.Sql
                typeof(MySqlItemIndexWriter).Assembly
            };

            Container container = new Container();

            ItemIndexFactory.ConfigureServices(
                container,
                indexAssemblies);

            container.Verify();

            // load seed configuration
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .AddInMemoryJson(profile);
            var configuration = builder.Build();

            return(new ItemIndexFactory(
                       container,
                       configuration,
                       _connectionString));
        }
コード例 #2
0
        public void GetReader_MsSql_NotNull()
        {
            ItemIndexFactory factory = _factoryProvider.GetFactory(MSSQL_PROFILE);
            IItemIndexReader writer  = factory.GetItemIndexReader();

            Assert.NotNull(writer);
        }