1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-23 08:15:27 +00:00
Sonarr/NzbDrone.Core/Main.cs
2010-09-23 19:19:55 -07:00

36 lines
1.2 KiB
C#

using System;
using System.IO;
using System.Web;
using log4net;
using Ninject;
using NzbDrone.Core.Controllers;
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");
kernel.Bind<ISeriesController>().To<SeriesController>();
kernel.Bind<IDiskController>().To<DiskController>();
kernel.Bind<ITvDbController>().To<TvDbController>();
kernel.Bind<IConfigController>().To<DbConfigController>();
kernel.Bind<ILog>().ToMethod(c => LogManager.GetLogger("logger-name"));
kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations));
}
private static string _appPath;
public static String AppPath
{
get { return new DirectoryInfo(HttpContext.Current.Server.MapPath("\\")).Parent.FullName; }
}
}
}