﻿using System.ComponentModel.Composition.Hosting;
using Raven.Client;
using Raven.Client.Indexes;

namespace Snittlistan.Infrastructure.Indexes
{
	public static class IndexCreator
	{
		public static void CreateIndexes(IDocumentStore store)
		{
			var typeCatalog = new TypeCatalog(typeof(Matches_PlayerStats), typeof(Match_ByDate));
			IndexCreation.CreateIndexes(new CompositionContainer(typeCatalog), store);
		}
	}
}
﻿using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Reflection;
using Raven.Client;
using Raven.Client.Indexes;

namespace Snittlistan.Infrastructure.Indexes
{
	public static class IndexCreator
	{
		public static void CreateIndexes(IDocumentStore store)
		{
			var indexes = from type in Assembly.GetExecutingAssembly().GetTypes()
						  where
							  type.IsSubclassOf(typeof(AbstractIndexCreationTask))
						  select type;

			var typeCatalog = new TypeCatalog(indexes.ToArray());
			IndexCreation.CreateIndexes(new CompositionContainer(typeCatalog), store);
		}
	}
}
Install all indexes by scanning assembly
Install all indexes by scanning assembly
