2010-09-23 03:19:47 +00:00
|
|
|
|
using System;
|
2010-09-24 02:19:55 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Web;
|
2010-09-23 03:19:47 +00:00
|
|
|
|
using log4net;
|
|
|
|
|
using Ninject;
|
2010-09-28 04:25:41 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
2010-09-23 03:19:47 +00:00
|
|
|
|
using SubSonic.DataProviders;
|
|
|
|
|
using SubSonic.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core
|
|
|
|
|
{
|
|
|
|
|
public static class Main
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public static void BindKernel(IKernel kernel)
|
|
|
|
|
{
|
2010-09-28 03:04:39 +00:00
|
|
|
|
string connectionString = String.Format("Data Source={0};Version=3;", Path.Combine(AppPath, "nzbdrone.db"));
|
2010-09-24 02:19:55 +00:00
|
|
|
|
var provider = ProviderFactory.GetProvider(connectionString, "System.Data.SQLite");
|
2010-09-23 03:19:47 +00:00
|
|
|
|
|
2010-09-28 04:25:41 +00:00
|
|
|
|
kernel.Bind<ISeriesProvider>().To<SeriesProvider>();
|
|
|
|
|
kernel.Bind<IDiskProvider>().To<DiskProvider>();
|
|
|
|
|
kernel.Bind<ITvDbProvider>().To<TvDbProvider>();
|
|
|
|
|
kernel.Bind<IConfigProvider>().To<ConfigProvider>();
|
2010-09-23 03:19:47 +00:00
|
|
|
|
kernel.Bind<ILog>().ToMethod(c => LogManager.GetLogger("logger-name"));
|
|
|
|
|
kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String AppPath
|
|
|
|
|
{
|
2010-09-24 02:19:55 +00:00
|
|
|
|
get { return new DirectoryInfo(HttpContext.Current.Server.MapPath("\\")).Parent.FullName; }
|
2010-09-23 03:19:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|