﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ninject.Modules;
using Ninject.Extensions.Conventions;

namespace SongManager.Web.NinjectSupport
{
	/// <summary>
	/// Automatically loads all Boot Modules and puts them into the Ninject Dependency Resolver
	/// </summary>
	public class DependencyBindingsModule : NinjectModule
	{
		public override void Load()
		{
			// Bind all BootModules
			Kernel.Bind( i => i.FromAssembliesMatching( "SongManager.Web.dll", "SongManager.Web.Core.dll", "SongManager.Web.Data.dll", "SongManager.Core.dll" )
					 .SelectAllClasses()
					 .InheritedFrom( typeof( SongManager.Core.Boot.IBootModule ) )
					 .BindSingleInterface()
			);

		}
	}
}