From bbf27c6f6670d5c98ae9073846b2c141bc66c294 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 18 Jun 2011 10:58:52 -0700 Subject: [PATCH] Fixed MVC profiler issue with Jobs, SQL profiling is on again. --- NzbDrone.Core/CentralDispatch.cs | 29 ++++++++++++++------------- NzbDrone.Core/Datastore/Connection.cs | 2 +- NzbDrone.Web/Global.asax.cs | 3 ++- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index d1223a5ab..6fce01635 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -68,7 +68,8 @@ namespace NzbDrone.Core _kernel = new StandardKernel(); _kernel.Bind().ToMethod(c => Connection.GetPetaPocoDb(Connection.MainConnectionString)).InRequestScope(); - _kernel.Bind().ToMethod(c => Connection.GetPetaPocoDb(Connection.MainConnectionString, false)).WhenInjectedInto().InSingletonScope(); + _kernel.Bind().ToMethod(c => Connection.GetPetaPocoDb(Connection.MainConnectionString, false)).WhenInjectedInto(); + _kernel.Bind().ToMethod(c => Connection.GetPetaPocoDb(Connection.MainConnectionString, false)).WhenInjectedInto(); _kernel.Bind().ToMethod(c => Connection.GetPetaPocoDb(Connection.LogConnectionString, false)).WhenInjectedInto().InSingletonScope(); _kernel.Bind().ToMethod(c => Connection.GetPetaPocoDb(Connection.LogConnectionString)).WhenInjectedInto().InRequestScope(); } @@ -76,10 +77,10 @@ namespace NzbDrone.Core private static void BindIndexers() { - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); + _kernel.Bind().To(); + _kernel.Bind().To(); + _kernel.Bind().To(); + _kernel.Bind().To(); var indexers = _kernel.GetAll(); _kernel.Get().InitializeIndexers(indexers.ToList()); @@ -87,15 +88,15 @@ namespace NzbDrone.Core private static void BindJobs() { - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); - _kernel.Bind().To().InTransientScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); + _kernel.Bind().To().InSingletonScope(); _kernel.Get().Initialize(); _kernel.Get().StartTimer(30); diff --git a/NzbDrone.Core/Datastore/Connection.cs b/NzbDrone.Core/Datastore/Connection.cs index a620e49ee..8749020f1 100644 --- a/NzbDrone.Core/Datastore/Connection.cs +++ b/NzbDrone.Core/Datastore/Connection.cs @@ -47,7 +47,7 @@ namespace NzbDrone.Core.Datastore DbConnection connection = new SQLiteConnection(connectionString); if (profiled) { - //connection = ProfiledDbConnection.Get(connection); + connection = ProfiledDbConnection.Get(connection); } var db = new Database(connection); diff --git a/NzbDrone.Web/Global.asax.cs b/NzbDrone.Web/Global.asax.cs index d282897a8..8bec6011c 100644 --- a/NzbDrone.Web/Global.asax.cs +++ b/NzbDrone.Web/Global.asax.cs @@ -41,7 +41,8 @@ namespace NzbDrone.Web //base.OnApplicationStarted(); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); - //RegisterRoutes(RouteTable.Routes); + + Logger.Debug("Fully initialized and ready."); } protected override IKernel CreateKernel()