From 1e73138f6dc878175515e3252bafd2b19fa3676b Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 5 Apr 2011 20:14:43 -0700 Subject: [PATCH] some subsonic cleanup --- NzbDrone.Core.Test/RepoTest.cs | 1 + NzbDrone.Core/CentralDispatch.cs | 7 ++++++- NzbDrone.Core/Instrumentation/Log.cs | 14 +++++++++++--- NzbDrone.Core/Model/SeasonParseResult.cs | 1 - NzbDrone.Core/Repository/History.cs | 2 +- NzbDrone.Core/Repository/Indexer.cs | 2 +- NzbDrone.Core/Repository/Quality/QualityProfile.cs | 2 +- NzbDrone.Core/Repository/RootDir.cs | 1 + 8 files changed, 22 insertions(+), 8 deletions(-) diff --git a/NzbDrone.Core.Test/RepoTest.cs b/NzbDrone.Core.Test/RepoTest.cs index 8d112ee18..8b6175fd4 100644 --- a/NzbDrone.Core.Test/RepoTest.cs +++ b/NzbDrone.Core.Test/RepoTest.cs @@ -76,6 +76,7 @@ namespace NzbDrone.Core.Test var sonicRepo = MockLib.GetEmptyRepository(); var sonicTarget = new SubsonicTarget(sonicRepo); + LogManager.Configuration.AddTarget("DbLogger", sonicTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Info, sonicTarget)); LogManager.Configuration.Reload(); diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 11388b1e2..3b7b21631 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -100,7 +100,12 @@ namespace NzbDrone.Core { get { - return HostingEnvironment.ApplicationPhysicalPath; + if (!String.IsNullOrWhiteSpace(HostingEnvironment.ApplicationPhysicalPath)) + { + return HostingEnvironment.ApplicationPhysicalPath; + } + return Directory.GetCurrentDirectory(); + } } diff --git a/NzbDrone.Core/Instrumentation/Log.cs b/NzbDrone.Core/Instrumentation/Log.cs index c6341dc00..46d202e31 100644 --- a/NzbDrone.Core/Instrumentation/Log.cs +++ b/NzbDrone.Core/Instrumentation/Log.cs @@ -5,28 +5,36 @@ namespace NzbDrone.Core.Instrumentation { public class Log { - public int LogId { get; set; } + [SubSonicPrimaryKey] + public int LogId { get; protected set; } + [SubSonicLongString] public string Message { get; set; } + public DateTime Time { get; set; } + public string Logger { get; set; } [SubSonicNullString] public string Stack { get; set; } + [SubSonicNullString] [SubSonicLongString] public string ExceptionMessage { get; set; } + [SubSonicNullString] [SubSonicLongString] public string ExceptionString { get; set; } + [SubSonicNullString] public string ExceptionType { get; set; } public LogLevel Level { get; set; } - //This is needed for telerik grid binding + //This is needed for Telerik grid binding [SubSonicIgnore] - public string DisplayLevel{ + public string DisplayLevel + { get { return Level.ToString(); } } } diff --git a/NzbDrone.Core/Model/SeasonParseResult.cs b/NzbDrone.Core/Model/SeasonParseResult.cs index 1a246173a..6c259c837 100644 --- a/NzbDrone.Core/Model/SeasonParseResult.cs +++ b/NzbDrone.Core/Model/SeasonParseResult.cs @@ -1,5 +1,4 @@ using NzbDrone.Core.Repository.Quality; -using SubSonic.SqlGeneration.Schema; namespace NzbDrone.Core.Model { diff --git a/NzbDrone.Core/Repository/History.cs b/NzbDrone.Core/Repository/History.cs index a5f0dead8..6faec0e7c 100644 --- a/NzbDrone.Core/Repository/History.cs +++ b/NzbDrone.Core/Repository/History.cs @@ -6,7 +6,7 @@ namespace NzbDrone.Core.Repository { public class History { - [SubSonicPrimaryKey(true)] + [SubSonicPrimaryKey] public virtual int HistoryId { get; set; } public virtual int EpisodeId { get; set; } public virtual int IndexerId { get; set; } diff --git a/NzbDrone.Core/Repository/Indexer.cs b/NzbDrone.Core/Repository/Indexer.cs index 5e4e17030..cc04180e4 100644 --- a/NzbDrone.Core/Repository/Indexer.cs +++ b/NzbDrone.Core/Repository/Indexer.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Repository { public class Indexer { - [SubSonicPrimaryKey(false)] + [SubSonicPrimaryKey] public virtual int IndexerId { get; set; } public string IndexerName { get; set; } diff --git a/NzbDrone.Core/Repository/Quality/QualityProfile.cs b/NzbDrone.Core/Repository/Quality/QualityProfile.cs index 672a80073..b34d62fef 100644 --- a/NzbDrone.Core/Repository/Quality/QualityProfile.cs +++ b/NzbDrone.Core/Repository/Quality/QualityProfile.cs @@ -8,7 +8,7 @@ namespace NzbDrone.Core.Repository.Quality { public class QualityProfile { - [SubSonicPrimaryKey(true)] + [SubSonicPrimaryKey] public virtual int QualityProfileId { get; set; } [Required(ErrorMessage = "A Name is Required")] diff --git a/NzbDrone.Core/Repository/RootDir.cs b/NzbDrone.Core/Repository/RootDir.cs index 7b21102c9..e6503492c 100644 --- a/NzbDrone.Core/Repository/RootDir.cs +++ b/NzbDrone.Core/Repository/RootDir.cs @@ -8,6 +8,7 @@ namespace NzbDrone.Core.Repository { public class RootDir { + [SubSonicPrimaryKey] public virtual int Id { get; set; } public string Path { get; set; }