You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/NzbDrone.Core/Main.cs

34 lines
1.1 KiB

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