mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Merge branch 'master' of git://github.com/kayone/NzbDrone
Conflicts: NzbDrone.Core.Test/SeriesProviderTest.cs NzbDrone.Core/Providers/MediaFileProvider.cs NzbDrone.Core/Providers/SeriesProvider.cs
This commit is contained in:
commit
0432109a95
BIN
Libraries/MigSharp.dll
Normal file
BIN
Libraries/MigSharp.dll
Normal file
Binary file not shown.
1335
Libraries/MigSharp.xml
Normal file
1335
Libraries/MigSharp.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -19,5 +19,11 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.72.0" newVersion="1.0.72.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="2.5.1.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@ -13,6 +13,7 @@
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using PetaPoco;
|
||||
using SubSonic.Repository;
|
||||
using TvdbLib.Data;
|
||||
|
||||
@ -22,6 +23,29 @@ namespace NzbDrone.Core.Test
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class EpisodeProviderTest : TestBase
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void GetEpisodesBySeason_success()
|
||||
{
|
||||
var episodes = Builder<Episode>.CreateListOfSize(10)
|
||||
.WhereAll().Have(c => c.SeriesId = 12)
|
||||
.WhereTheFirst(5).Have(c => c.SeasonNumber = 1)
|
||||
.AndTheRemaining().Have(c => c.SeasonNumber = 2).Build();
|
||||
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
var mocker = new AutoMoqer();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
episodes.ToList().ForEach(c => db.Insert(c));
|
||||
|
||||
//Act
|
||||
var seasonEposodes = mocker.Resolve<EpisodeProvider>().GetEpisodesBySeason(12, 2);
|
||||
|
||||
//Assert
|
||||
db.Fetch<Episode>().Should().HaveCount(10);
|
||||
seasonEposodes.Should().HaveCount(5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshEpisodeInfo_emptyRepo()
|
||||
{
|
||||
@ -42,7 +66,7 @@ public void RefreshEpisodeInfo_emptyRepo()
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||
mocker.SetConstant(MockLib.GetEmptyDatabase());
|
||||
|
||||
mocker.GetMock<TvDbProvider>()
|
||||
.Setup(c => c.GetSeries(seriesId, true))
|
||||
@ -61,65 +85,72 @@ public void RefreshEpisodeInfo_emptyRepo()
|
||||
|
||||
|
||||
[Test]
|
||||
public void new_episodes_only_calls_AddMany()
|
||||
public void new_episodes_only_calls_Insert()
|
||||
{
|
||||
const int seriesId = 71663;
|
||||
var fakeEpisodes = Builder<TvdbSeries>.CreateNew()
|
||||
var tvdbSeries = Builder<TvdbSeries>.CreateNew()
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||
.Setup(c => c.GetSeries(seriesId, true))
|
||||
.Returns(fakeEpisodes);
|
||||
.Returns(tvdbSeries);
|
||||
|
||||
mocker.GetMock<IDatabase>()
|
||||
.Setup(d => d.Fetch<Episode>(It.IsAny<String>(), It.IsAny<Object[]>()))
|
||||
.Returns(currentEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
mocker.GetMock<IRepository>().Verify(
|
||||
c => c.AddMany(It.Is<IEnumerable<Episode>>(e => e.Count() == fakeEpisodes.Episodes.Count)), Times.Once());
|
||||
mocker.GetMock<IRepository>().Verify(c => c.UpdateMany(It.Is<IEnumerable<Episode>>(e => e.Count() == 0)),
|
||||
Times.AtMostOnce());
|
||||
mocker.GetMock<IDatabase>().Verify(c => c.Insert(It.IsAny<Object>()), Times.Exactly(tvdbSeries.Episodes.Count));
|
||||
mocker.GetMock<IDatabase>().Verify(c => c.Update(It.IsAny<Object>()), Times.Never());
|
||||
|
||||
mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void existing_episodes_only_calls_UpdateMany()
|
||||
public void existing_episodes_only_calls_Update()
|
||||
{
|
||||
const int seriesId = 71663;
|
||||
var fakeEpisodes = Builder<TvdbSeries>.CreateNew()
|
||||
var tvdbSeries = Builder<TvdbSeries>.CreateNew()
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
foreach (var tvDbEpisode in tvdbSeries.Episodes)
|
||||
{
|
||||
currentEpisodes.Add(new Episode { TvDbEpisodeId = tvDbEpisode.Id });
|
||||
}
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||
.Setup(c => c.GetSeries(seriesId, true))
|
||||
.Returns(fakeEpisodes);
|
||||
.Returns(tvdbSeries);
|
||||
|
||||
mocker.GetMock<IRepository>()
|
||||
.Setup(c => c.Single(It.IsAny<Expression<Func<Episode, bool>>>()))
|
||||
.Returns(Builder<Episode>.CreateNew().Build);
|
||||
mocker.GetMock<IDatabase>()
|
||||
.Setup(d => d.Fetch<Episode>(It.IsAny<String>(), It.IsAny<Object[]>()))
|
||||
.Returns(currentEpisodes);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
mocker.GetMock<IRepository>().Verify(c => c.AddMany(It.Is<IEnumerable<Episode>>(e => e.Count() == 0)),
|
||||
Times.AtMostOnce());
|
||||
mocker.GetMock<IRepository>().Verify(
|
||||
c => c.UpdateMany(It.Is<IEnumerable<Episode>>(e => e.Count() == fakeEpisodes.Episodes.Count)),
|
||||
Times.Once());
|
||||
mocker.GetMock<IDatabase>().Verify(c => c.Insert(It.IsAny<Object>()), Times.Never());
|
||||
mocker.GetMock<IDatabase>().Verify(c => c.Update(It.IsAny<Object>()), Times.Exactly(tvdbSeries.Episodes.Count));
|
||||
mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
@ -128,7 +159,7 @@ public void existing_episodes_only_calls_UpdateMany()
|
||||
public void should_try_to_get_existing_episode_using_tvdbid_first()
|
||||
{
|
||||
const int seriesId = 71663;
|
||||
var fakeEpisodes = Builder<TvdbSeries>.CreateNew()
|
||||
var fakeTvDbResult = Builder<TvdbSeries>.CreateNew()
|
||||
.With(c => c.Id = seriesId)
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(
|
||||
Builder<TvdbEpisode>.CreateListOfSize(1)
|
||||
@ -137,33 +168,31 @@ public void should_try_to_get_existing_episode_using_tvdbid_first()
|
||||
)
|
||||
.Build();
|
||||
|
||||
var fakeEpisodeList = new List<Episode> { new Episode { TvDbEpisodeId = 99, SeasonNumber = 10, EpisodeNumber = 10 } };
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
mocker.GetMock<IDatabase>()
|
||||
.Setup(d => d.Fetch<Episode>(It.IsAny<String>(), It.IsAny<Object[]>()))
|
||||
.Returns(fakeEpisodeList);
|
||||
|
||||
var repo = MockLib.GetEmptyRepository();
|
||||
repo.Add<Episode>(
|
||||
Builder<Episode>.CreateNew().With(c => c.TvDbEpisodeId = fakeEpisodes.Episodes[0].Id).Build());
|
||||
mocker.SetConstant(repo);
|
||||
|
||||
mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||
mocker.GetMock<TvDbProvider>()
|
||||
.Setup(c => c.GetSeries(seriesId, true))
|
||||
.Returns(fakeEpisodes);
|
||||
.Returns(fakeTvDbResult);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
repo.All<Episode>().Should().HaveCount(1);
|
||||
mocker.GetMock<IDatabase>().Verify(c => c.Update(fakeEpisodeList[0]), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_try_to_get_existing_episode_using_tvdbid_first_then_season_episode()
|
||||
{
|
||||
const int seriesId = 71663;
|
||||
var fakeEpisodes = Builder<TvdbSeries>.CreateNew()
|
||||
var tvdbSeries = Builder<TvdbSeries>.CreateNew()
|
||||
.With(c => c.Id = seriesId)
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>{
|
||||
Builder<TvdbEpisode>.CreateNew()
|
||||
@ -187,20 +216,20 @@ public void should_try_to_get_existing_episode_using_tvdbid_first_then_season_ep
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
var repo = MockLib.GetEmptyRepository();
|
||||
repo.Add<Episode>(localEpisode);
|
||||
mocker.SetConstant(repo);
|
||||
|
||||
mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||
.Setup(c => c.GetSeries(seriesId, true))
|
||||
.Returns(fakeEpisodes);
|
||||
.Returns(tvdbSeries);
|
||||
|
||||
mocker.GetMock<IDatabase>()
|
||||
.Setup(d => d.Fetch<Episode>(It.IsAny<String>(), It.IsAny<Object[]>()))
|
||||
.Returns(new List<Episode> { localEpisode });
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
repo.All<Episode>().Should().HaveCount(1);
|
||||
mocker.GetMock<IDatabase>().Verify(c => c.Update(localEpisode), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
@ -208,51 +237,43 @@ public void should_try_to_get_existing_episode_using_tvdbid_first_then_season_ep
|
||||
public void existing_episodes_keep_their_episodeId_file_id()
|
||||
{
|
||||
const int seriesId = 71663;
|
||||
var faketvDbResponse = Builder<TvdbSeries>.CreateNew()
|
||||
var tvdbSeries = Builder<TvdbSeries>.CreateNew()
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeEpisode =
|
||||
Builder<Episode>.CreateNew().With(c => c.EpisodeFileId = 69).And(c => c.EpisodeId = 99).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
foreach (var tvDbEpisode in tvdbSeries.Episodes)
|
||||
{
|
||||
currentEpisodes.Add(new Episode { TvDbEpisodeId = tvDbEpisode.Id, EpisodeId = 99, EpisodeFileId = 69, Ignored = true });
|
||||
}
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||
.Setup(c => c.GetSeries(seriesId, true))
|
||||
.Returns(faketvDbResponse);
|
||||
.Returns(tvdbSeries);
|
||||
|
||||
IEnumerable<Episode> updatedEpisodes = null;
|
||||
var updatedEpisodes = new List<Episode>();
|
||||
|
||||
mocker.GetMock<IRepository>()
|
||||
.Setup(c => c.Single(It.IsAny<Expression<Func<Episode, bool>>>()))
|
||||
.Returns(fakeEpisode);
|
||||
mocker.GetMock<IDatabase>()
|
||||
.Setup(d => d.Fetch<Episode>(It.IsAny<String>(), It.IsAny<Object[]>()))
|
||||
.Returns(currentEpisodes);
|
||||
|
||||
mocker.GetMock<IRepository>()
|
||||
.Setup(c => c.UpdateMany(It.IsAny<IEnumerable<Episode>>()))
|
||||
.Returns(faketvDbResponse.Episodes.Count)
|
||||
.Callback<IEnumerable<Episode>>(r => updatedEpisodes = r);
|
||||
mocker.GetMock<IDatabase>()
|
||||
.Setup(c => c.Update(It.IsAny<Episode>()))
|
||||
.Returns(1)
|
||||
.Callback<Episode>(ep => updatedEpisodes.Add(ep));
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
mocker.GetMock<IRepository>().Verify(c => c.AddMany(It.Is<IEnumerable<Episode>>(e => e.Count() == 0)),
|
||||
Times.AtMostOnce());
|
||||
mocker.GetMock<IRepository>().Verify(
|
||||
c => c.UpdateMany(It.Is<IEnumerable<Episode>>(e => e.Count() == faketvDbResponse.Episodes.Count)),
|
||||
Times.Once());
|
||||
mocker.GetMock<IRepository>().Verify(
|
||||
c =>
|
||||
c.UpdateMany(
|
||||
It.Is<IEnumerable<Episode>>(
|
||||
e => e.Where(g => g.EpisodeFileId == 69).Count() == faketvDbResponse.Episodes.Count)),
|
||||
Times.Once());
|
||||
|
||||
|
||||
updatedEpisodes.Should().HaveSameCount(faketvDbResponse.Episodes);
|
||||
updatedEpisodes.Should().HaveSameCount(tvdbSeries.Episodes);
|
||||
updatedEpisodes.Should().OnlyContain(c => c.EpisodeId == 99);
|
||||
updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 69);
|
||||
updatedEpisodes.Should().OnlyContain(c => c.Ignored == true);
|
||||
}
|
||||
|
||||
|
||||
@ -347,7 +368,7 @@ public void IsSeasonIgnored_should_return_true_if_invalid_series()
|
||||
public void Add_daily_show_episodes()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||
mocker.SetConstant(MockLib.GetEmptyDatabase());
|
||||
mocker.Resolve<TvDbProvider>();
|
||||
const int tvDbSeriesId = 71256;
|
||||
//act
|
||||
|
@ -10,6 +10,7 @@
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using PetaPoco;
|
||||
using SubSonic.DataProviders;
|
||||
using SubSonic.Repository;
|
||||
|
||||
@ -38,7 +39,7 @@ public static ConfigProvider StandardConfig
|
||||
|
||||
public static IRepository GetEmptyRepository(bool enableLogging = false, string fileName = "")
|
||||
{
|
||||
Console.WriteLine("Creating an empty SQLite database");
|
||||
Console.WriteLine("Creating an empty Subsonic repository");
|
||||
|
||||
if (String.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
@ -50,7 +51,7 @@ public static IRepository GetEmptyRepository(bool enableLogging = false, string
|
||||
var repo = Connection.CreateSimpleRepository(provider);
|
||||
ForceMigration(repo);
|
||||
|
||||
Migrations.Run(Connection.GetConnectionString(fileName), false);
|
||||
//Migrations.Run(Connection.GetConnectionString(fileName), false);
|
||||
|
||||
if (enableLogging)
|
||||
{
|
||||
@ -62,6 +63,24 @@ public static IRepository GetEmptyRepository(bool enableLogging = false, string
|
||||
return repo;
|
||||
}
|
||||
|
||||
public static IDatabase GetEmptyDatabase(bool enableLogging = false, string fileName = "")
|
||||
{
|
||||
Console.WriteLine("Creating an empty PetaPoco database");
|
||||
|
||||
if (String.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
fileName = Guid.NewGuid() + ".db";
|
||||
}
|
||||
|
||||
var connectionString = Connection.GetConnectionString(fileName);
|
||||
|
||||
MigrationsHelper.MigrateDatabase(connectionString);
|
||||
|
||||
var database = Connection.GetPetaPocoDb(connectionString);
|
||||
|
||||
return database;
|
||||
}
|
||||
|
||||
public static DiskProvider GetStandardDisk(int seasons, int episodes)
|
||||
{
|
||||
var mock = new Mock<DiskProvider>();
|
||||
|
@ -36,6 +36,9 @@
|
||||
<Reference Include="Accessibility">
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core">
|
||||
<HintPath>..\packages\Castle.Core.2.5.2\lib\NET35\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FizzWare.NBuilder">
|
||||
<HintPath>..\packages\NBuilder.2.3.0.0\lib\FizzWare.NBuilder.dll</HintPath>
|
||||
</Reference>
|
||||
@ -72,11 +75,9 @@
|
||||
<Reference Include="pnunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SubSonic.Core, Version=3.0.0.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Libraries\SubSonic.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SubSonic.Core, Version=3.0.0.3, Culture=neutral, processorArchitecture=x86" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.72.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>..\Libraries\System.Data.SQLite.dll</HintPath>
|
||||
|
@ -42,7 +42,6 @@ public void to_many__series_to_episode()
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void query_scratch_pad()
|
||||
{
|
||||
|
||||
|
Binary file not shown.
@ -14,6 +14,7 @@ namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
[Ignore]
|
||||
public class DbBenchmark : TestBase
|
||||
{
|
||||
const int Episodes_Per_Season = 20;
|
||||
@ -90,7 +91,7 @@ public class DbBenchmark : TestBase
|
||||
[Test]
|
||||
public void get_episode_by_series_seasons_episode_x5000()
|
||||
{
|
||||
var epProvider = new EpisodeProvider(repo, null);
|
||||
var epProvider = new EpisodeProvider(null, null);
|
||||
|
||||
|
||||
Thread.Sleep(1000);
|
||||
@ -114,7 +115,7 @@ public void get_episode_by_series_seasons_episode_x5000()
|
||||
[Test]
|
||||
public void get_episode_by_series_seasons_x1000()
|
||||
{
|
||||
var epProvider = new EpisodeProvider(repo, null);
|
||||
var epProvider = new EpisodeProvider( null, null);
|
||||
|
||||
|
||||
Thread.Sleep(1000);
|
||||
|
@ -7,4 +7,6 @@
|
||||
<package id="CommonServiceLocator" version="1.0" />
|
||||
<package id="Unity" version="2.1.505.0" />
|
||||
<package id="NUnit" version="2.5.10.11092" />
|
||||
<package id="PetaPoco.Core" version="4.0.2" />
|
||||
<package id="Castle.Core" version="2.5.2" />
|
||||
</packages>
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Web.Hosting;
|
||||
@ -9,13 +8,10 @@
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.ExternalNotification;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using SubSonic.DataProviders;
|
||||
using PetaPoco;
|
||||
using SubSonic.Repository;
|
||||
|
||||
namespace NzbDrone.Core
|
||||
@ -56,7 +52,7 @@ private static void InitializeApp()
|
||||
|
||||
LogConfiguration.StartDbLogging();
|
||||
|
||||
Migrations.Run(Connection.MainConnectionString, true);
|
||||
MigrationsHelper.Run(Connection.MainConnectionString, true);
|
||||
|
||||
_kernel.Get<QualityProvider>().SetupDefaultProfiles();
|
||||
|
||||
@ -72,28 +68,7 @@ public static void BindKernel()
|
||||
Logger.Debug("Binding Ninject's Kernel");
|
||||
_kernel = new StandardKernel();
|
||||
|
||||
//dbProvider.Log = new NlogWriter();
|
||||
_kernel.Bind<QualityProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<TvDbProvider>().ToSelf().InTransientScope();
|
||||
_kernel.Bind<HttpProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<SeriesProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<EpisodeProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<UpcomingEpisodesProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<DiskProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<SabProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<HistoryProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<RootDirProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<ExternalNotificationProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<XbmcProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<ConfigProvider>().To<ConfigProvider>().InSingletonScope();
|
||||
_kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<LogProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<MediaFileProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<JobProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<WebTimer>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<AutoConfigureProvider>().ToSelf().InSingletonScope();
|
||||
|
||||
_kernel.Bind<IDatabase>().ToMethod(c => Connection.GetPetaPocoDb(Connection.MainConnectionString)).InRequestScope();
|
||||
_kernel.Bind<IRepository>().ToConstant(Connection.CreateSimpleRepository(Connection.MainConnectionString)).InSingletonScope();
|
||||
_kernel.Bind<IRepository>().ToConstant(Connection.CreateSimpleRepository(Connection.LogConnectionString)).WhenInjectedInto<SubsonicTarget>().InSingletonScope();
|
||||
_kernel.Bind<IRepository>().ToConstant(Connection.CreateSimpleRepository(Connection.LogConnectionString)).WhenInjectedInto<LogProvider>().InSingletonScope();
|
||||
@ -102,10 +77,10 @@ public static void BindKernel()
|
||||
|
||||
private static void BindIndexers()
|
||||
{
|
||||
_kernel.Bind<IndexerBase>().To<NzbsOrg>().InSingletonScope();
|
||||
_kernel.Bind<IndexerBase>().To<NzbMatrix>().InSingletonScope();
|
||||
_kernel.Bind<IndexerBase>().To<NzbsRUs>().InSingletonScope();
|
||||
_kernel.Bind<IndexerBase>().To<Newzbin>().InSingletonScope();
|
||||
_kernel.Bind<IndexerBase>().To<NzbsOrg>().InTransientScope();
|
||||
_kernel.Bind<IndexerBase>().To<NzbMatrix>().InTransientScope();
|
||||
_kernel.Bind<IndexerBase>().To<NzbsRUs>().InTransientScope();
|
||||
_kernel.Bind<IndexerBase>().To<Newzbin>().InTransientScope();
|
||||
|
||||
var indexers = _kernel.GetAll<IndexerBase>();
|
||||
_kernel.Get<IndexerProvider>().InitializeIndexers(indexers.ToList());
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Data.SQLite;
|
||||
using System.IO;
|
||||
using MvcMiniProfiler.Data;
|
||||
using PetaPoco;
|
||||
using SubSonic.DataProviders;
|
||||
using SubSonic.DataProviders.SQLite;
|
||||
using SubSonic.Repository;
|
||||
@ -53,6 +55,16 @@ public static IRepository CreateSimpleRepository(string connectionString)
|
||||
return new SimpleRepository(GetDataProvider(connectionString), SimpleRepositoryOptions.RunMigrations);
|
||||
}
|
||||
|
||||
public static IDatabase GetPetaPocoDb(string connectionString)
|
||||
{
|
||||
var profileConnection = ProfiledDbConnection.Get(new SQLiteConnection(connectionString));
|
||||
PetaPoco.Database.Mapper = new CustomeMapper();
|
||||
var db = new PetaPoco.Database(profileConnection);
|
||||
db.OpenSharedConnection();
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +79,7 @@ public ProfiledSQLiteProvider(string connectionString, string providerName)
|
||||
public override System.Data.Common.DbConnection CreateConnection(string connectionString)
|
||||
{
|
||||
return ProfiledDbConnection.Get(base.CreateConnection(connectionString));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
48
NzbDrone.Core/Datastore/CustomeMapper.cs
Normal file
48
NzbDrone.Core/Datastore/CustomeMapper.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
public class CustomeMapper : DefaultMapper
|
||||
{
|
||||
public override Func<object, object> GetFromDbConverter(DestinationInfo destinationInfo, Type SourceType)
|
||||
{
|
||||
|
||||
if ((SourceType == typeof(Int32) || SourceType == typeof(Int64)) && destinationInfo.Type.IsGenericType && destinationInfo.Type.GetGenericTypeDefinition() == typeof(Nullable<>))
|
||||
{
|
||||
// If it is NULLABLE, then get the underlying type. eg if "Nullable<int>" then this will return just "int"
|
||||
Type genericArgument = destinationInfo.Type.GetGenericArguments()[0];
|
||||
if (genericArgument == typeof(DayOfWeek))
|
||||
{
|
||||
return delegate(object s)
|
||||
{
|
||||
int value;
|
||||
Int32.TryParse(s.ToString(), out value);
|
||||
if (value == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (Nullable<DayOfWeek>)value;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return delegate(object s)
|
||||
{
|
||||
int value;
|
||||
Int32.TryParse(s.ToString(), out value);
|
||||
if (value == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetFromDbConverter(destinationInfo, SourceType);
|
||||
}
|
||||
}
|
||||
}
|
69
NzbDrone.Core/Datastore/Migrations/Legacy/Migration.cs
Normal file
69
NzbDrone.Core/Datastore/Migrations/Legacy/Migration.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Migrator.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migrations.Legacy
|
||||
{
|
||||
[Migration(20110523)]
|
||||
public class Migration20110523 : Migration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
Database.RemoveTable(RepositoryProvider.JobsSchema.Name);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[Migration(20110603)]
|
||||
public class Migration20110603 : Migration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
Database.RemoveTable("Seasons");
|
||||
|
||||
MigrationsHelper.RemoveDeletedColumns(Database);
|
||||
MigrationsHelper.AddNewColumns(Database);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[Migration(20110604)]
|
||||
public class Migration20110604 : Migration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
MigrationsHelper.ForceSubSonicMigration(Connection.CreateSimpleRepository(Connection.MainConnectionString));
|
||||
|
||||
var episodesTable = RepositoryProvider.EpisodesSchema;
|
||||
//Database.AddIndex("idx_episodes_series_season_episode", episodesTable.Name, true,
|
||||
// episodesTable.GetColumnByPropertyName("SeriesId").Name,
|
||||
// episodesTable.GetColumnByPropertyName("SeasonNumber").Name,
|
||||
// episodesTable.GetColumnByPropertyName("EpisodeNumber").Name);
|
||||
|
||||
Database.AddIndex("idx_episodes_series_season", episodesTable.Name, false,
|
||||
episodesTable.GetColumnByPropertyName("SeriesId").Name,
|
||||
episodesTable.GetColumnByPropertyName("SeasonNumber").Name);
|
||||
|
||||
Database.AddIndex("idx_episodes_series", episodesTable.Name, false,
|
||||
episodesTable.GetColumnByPropertyName("SeriesId").Name);
|
||||
|
||||
MigrationsHelper.RemoveDeletedColumns(Database);
|
||||
MigrationsHelper.AddNewColumns(Database);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
51
NzbDrone.Core/Datastore/Migrations/MigrationExport.cs
Normal file
51
NzbDrone.Core/Datastore/Migrations/MigrationExport.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MigSharp;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migrations
|
||||
{
|
||||
[MigrationExport]
|
||||
internal class Migration1 : IMigration
|
||||
{
|
||||
public void Up(IDatabase db)
|
||||
{
|
||||
db.CreateTable("Series")
|
||||
.WithPrimaryKeyColumn("SeriesId", DbType.Int32).AsIdentity()
|
||||
.WithNullableColumn("Title", DbType.String)
|
||||
.WithNullableColumn("CleanTitle", DbType.String)
|
||||
.WithNullableColumn("Status", DbType.String)
|
||||
.WithNullableColumn("Overview", DbType.String)
|
||||
.WithNullableColumn("AirsDayOfWeek", DbType.Int16)
|
||||
.WithNullableColumn("AirTimes", DbType.String)
|
||||
.WithNullableColumn("Language", DbType.String)
|
||||
.WithNotNullableColumn("Path", DbType.String)
|
||||
.WithNotNullableColumn("Monitored", DbType.Boolean)
|
||||
.WithNotNullableColumn("QualityProfileId", DbType.Int16)
|
||||
.WithNotNullableColumn("SeasonFolder", DbType.Boolean)
|
||||
.WithNullableColumn("LastInfoSync", DbType.DateTime)
|
||||
.WithNullableColumn("LastDiskSync", DbType.DateTime);
|
||||
|
||||
|
||||
db.CreateTable("Episodes")
|
||||
.WithPrimaryKeyColumn("EpisodeId", DbType.Int32).AsIdentity()
|
||||
.WithNullableColumn("TvDbEpisodeId", DbType.Int32)
|
||||
|
||||
.WithNotNullableColumn("SeriesId", DbType.Int32)
|
||||
.WithNotNullableColumn("SeasonNumber", DbType.Int16)
|
||||
.WithNotNullableColumn("EpisodeNumber", DbType.Int16)
|
||||
.WithNotNullableColumn("Title", DbType.String).HavingDefault(String.Empty)
|
||||
|
||||
.WithNotNullableColumn("Overview", DbType.String).HavingDefault(String.Empty)
|
||||
.WithNotNullableColumn("Ignored", DbType.Boolean).HavingDefault(false)
|
||||
.WithNullableColumn("EpisodeFileId", DbType.Int32)
|
||||
.WithNullableColumn("AirDate", DbType.DateTime)
|
||||
.WithNullableColumn("GrabDate", DbType.DateTime);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Migrator.Framework;
|
||||
using MigSharp;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
@ -14,7 +15,7 @@
|
||||
|
||||
namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
public class Migrations
|
||||
public class MigrationsHelper
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
@ -27,11 +28,11 @@ public static void Run(string connetionString, bool trace)
|
||||
Migrator.Migrator migrator;
|
||||
if (trace)
|
||||
{
|
||||
migrator = new Migrator.Migrator("Sqlite", connetionString, Assembly.GetAssembly(typeof(Migrations)), true, new MigrationLogger());
|
||||
migrator = new Migrator.Migrator("Sqlite", connetionString, Assembly.GetAssembly(typeof(MigrationsHelper)), true, new MigrationLogger());
|
||||
}
|
||||
else
|
||||
{
|
||||
migrator = new Migrator.Migrator("Sqlite", connetionString, Assembly.GetAssembly(typeof(Migrations)));
|
||||
migrator = new Migrator.Migrator("Sqlite", connetionString, Assembly.GetAssembly(typeof(MigrationsHelper)));
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +51,13 @@ public static void Run(string connetionString, bool trace)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void MigrateDatabase(string connectionString)
|
||||
{
|
||||
var migrator = new MigSharp.Migrator(connectionString, ProviderNames.SQLite);
|
||||
migrator.MigrateAll(typeof(MigrationsHelper).Assembly);
|
||||
}
|
||||
|
||||
public static void ForceSubSonicMigration(IRepository repository)
|
||||
{
|
||||
repository.Single<Series>(1);
|
||||
@ -114,64 +122,5 @@ public static void AddNewColumns(ITransformationProvider transformationProvider)
|
||||
|
||||
}
|
||||
|
||||
[Migration(20110523)]
|
||||
public class Migration20110523 : Migration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
Database.RemoveTable(RepositoryProvider.JobsSchema.Name);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[Migration(20110603)]
|
||||
public class Migration20110603 : Migration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
Database.RemoveTable("Seasons");
|
||||
|
||||
Migrations.RemoveDeletedColumns(Database);
|
||||
Migrations.AddNewColumns(Database);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[Migration(20110604)]
|
||||
public class Migration20110604 : Migration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
Migrations.ForceSubSonicMigration(Connection.CreateSimpleRepository(Connection.MainConnectionString));
|
||||
|
||||
var episodesTable = RepositoryProvider.EpisodesSchema;
|
||||
//Database.AddIndex("idx_episodes_series_season_episode", episodesTable.Name, true,
|
||||
// episodesTable.GetColumnByPropertyName("SeriesId").Name,
|
||||
// episodesTable.GetColumnByPropertyName("SeasonNumber").Name,
|
||||
// episodesTable.GetColumnByPropertyName("EpisodeNumber").Name);
|
||||
|
||||
Database.AddIndex("idx_episodes_series_season", episodesTable.Name, false,
|
||||
episodesTable.GetColumnByPropertyName("SeriesId").Name,
|
||||
episodesTable.GetColumnByPropertyName("SeasonNumber").Name);
|
||||
|
||||
Database.AddIndex("idx_episodes_series", episodesTable.Name, false,
|
||||
episodesTable.GetColumnByPropertyName("SeriesId").Name);
|
||||
|
||||
Migrations.RemoveDeletedColumns(Database);
|
||||
Migrations.AddNewColumns(Database);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
2445
NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs
Normal file
2445
NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -129,6 +129,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Libraries\Exceptioneer.WindowsFormsClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="MigSharp">
|
||||
<HintPath>..\Libraries\MigSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MvcMiniProfiler">
|
||||
<HintPath>..\packages\MiniProfiler.1.2\lib\MvcMiniProfiler.dll</HintPath>
|
||||
</Reference>
|
||||
@ -139,10 +143,12 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Libraries\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SubSonic.Core">
|
||||
<Reference Include="SubSonic.Core, Version=3.0.0.3, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Libraries\SubSonic.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
@ -165,7 +171,10 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Datastore\Connection.cs" />
|
||||
<Compile Include="Datastore\MigrationLogger.cs" />
|
||||
<Compile Include="Datastore\Migrations.cs" />
|
||||
<Compile Include="Datastore\MigrationsHelper.cs" />
|
||||
<Compile Include="Datastore\CustomeMapper.cs" />
|
||||
<Compile Include="Datastore\Migrations\MigrationExport.cs" />
|
||||
<Compile Include="Datastore\Migrations\Legacy\Migration.cs" />
|
||||
<Compile Include="Datastore\RepositoryProvider.cs" />
|
||||
<Compile Include="Datastore\SqliteProvider.cs" />
|
||||
<Compile Include="Helpers\EpisodeRenameHelper.cs" />
|
||||
@ -175,6 +184,7 @@
|
||||
<Compile Include="Instrumentation\SubsonicTarget.cs" />
|
||||
<Compile Include="Instrumentation\ExceptioneerTarget.cs" />
|
||||
<Compile Include="Instrumentation\NlogWriter.cs" />
|
||||
<Compile Include="Datastore\PetaPoco\PetaPoco.cs" />
|
||||
<Compile Include="Model\ConnectionInfoModel.cs" />
|
||||
<Compile Include="Model\ExternalNotificationType.cs" />
|
||||
<Compile Include="Model\LanguageType.cs" />
|
||||
@ -292,6 +302,15 @@
|
||||
<Name>Migrator</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
Binary file not shown.
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MvcMiniProfiler;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
@ -205,13 +206,16 @@ public virtual IEnumerable<EpisodeFile> GetSeriesFiles(int seriesId)
|
||||
|
||||
public virtual Tuple<int, int> GetEpisodeFilesCount(int seriesId)
|
||||
{
|
||||
var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId).ToList();
|
||||
using (MiniProfiler.Current.Step("GetEpisodeFilesCount:" + seriesId))
|
||||
{
|
||||
var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId);
|
||||
|
||||
var episodeTotal = allEpisodes.Where(e => !e.Ignored && e.AirDate <= DateTime.Today && e.AirDate.Year > 1900).ToList();
|
||||
var avilableEpisodes = episodeTotal.Where(e => e.EpisodeFileId > 0).ToList();
|
||||
|
||||
return new Tuple<int, int>(avilableEpisodes.Count, episodeTotal.Count);
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> GetMediaFileList(string path)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using PetaPoco;
|
||||
using SubSonic.Repository;
|
||||
using TvdbLib.Data;
|
||||
|
||||
@ -20,15 +21,17 @@ public class SeriesProvider
|
||||
private readonly IRepository _repository;
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private readonly TvDbProvider _tvDbProvider;
|
||||
private readonly SceneNameMappingProvider _sceneNameMappingProvider;
|
||||
private readonly IDatabase _database;
|
||||
private readonly QualityProvider _qualityProvider;
|
||||
|
||||
public SeriesProvider(ConfigProvider configProviderProvider, IRepository repository,
|
||||
TvDbProvider tvDbProviderProvider, SceneNameMappingProvider sceneNameMappingProvider)
|
||||
public SeriesProvider(ConfigProvider configProviderProvider, IRepository repository, TvDbProvider tvDbProviderProvider, IDatabase database, QualityProvider qualityProvider)
|
||||
{
|
||||
_configProvider = configProviderProvider;
|
||||
_repository = repository;
|
||||
_tvDbProvider = tvDbProviderProvider;
|
||||
_sceneNameMappingProvider = sceneNameMappingProvider;
|
||||
_database = database;
|
||||
_qualityProvider = qualityProvider;
|
||||
}
|
||||
|
||||
public SeriesProvider()
|
||||
@ -37,12 +40,14 @@ public SeriesProvider()
|
||||
|
||||
public virtual IList<Series> GetAllSeries()
|
||||
{
|
||||
return _repository.All<Series>().ToList();
|
||||
var series = _database.Fetch<Series>();
|
||||
series.ForEach(c => c.QualityProfile = _qualityProvider.Find(c.QualityProfileId));
|
||||
return series;
|
||||
}
|
||||
|
||||
public virtual Series GetSeries(int seriesId)
|
||||
{
|
||||
return _repository.Single<Series>(seriesId);
|
||||
return _database.Single<Series>("WHERE seriesId= @0", seriesId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -52,7 +57,7 @@ public virtual Series GetSeries(int seriesId)
|
||||
/// <returns>Whether or not the show is monitored</returns>
|
||||
public virtual bool IsMonitored(long id)
|
||||
{
|
||||
return _repository.Exists<Series>(c => c.SeriesId == id && c.Monitored);
|
||||
return GetAllSeries().Any(c => c.SeriesId == id && c.Monitored);
|
||||
}
|
||||
|
||||
public virtual TvdbSeries MapPathToSeries(string path)
|
||||
@ -99,7 +104,7 @@ public virtual void AddSeries(string path, int tvDbSeriesId, int qualityProfileI
|
||||
|
||||
repoSeries.SeasonFolder = _configProvider.UseSeasonFolder;
|
||||
|
||||
_repository.Add(repoSeries);
|
||||
_database.Insert(repoSeries);
|
||||
}
|
||||
|
||||
public virtual Series FindSeries(string title)
|
||||
@ -112,12 +117,12 @@ public virtual Series FindSeries(string title)
|
||||
return GetSeries(seriesId.Value);
|
||||
}
|
||||
|
||||
return _repository.Single<Series>(s => s.CleanTitle == normalizeTitle);
|
||||
return _database.Single<Series>("WHERE CleanTitle = @0", normalizeTitle);
|
||||
}
|
||||
|
||||
public virtual void UpdateSeries(Series series)
|
||||
{
|
||||
_repository.Update(series);
|
||||
_database.Update(series);
|
||||
}
|
||||
|
||||
public virtual void DeleteSeries(int seriesId)
|
||||
@ -150,7 +155,7 @@ public virtual void DeleteSeries(int seriesId)
|
||||
|
||||
public virtual bool SeriesPathExists(string cleanPath)
|
||||
{
|
||||
if (_repository.Exists<Series>(s => s.Path == cleanPath))
|
||||
if (GetAllSeries().Any(s => s.Path == cleanPath))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Model;
|
||||
using PetaPoco;
|
||||
using SubSonic.SqlGeneration.Schema;
|
||||
|
||||
|
||||
namespace NzbDrone.Core.Repository
|
||||
{
|
||||
[TableName("Episodes")]
|
||||
[PrimaryKey("EpisodeId", autoIncrement = true)]
|
||||
public class Episode
|
||||
{
|
||||
[SubSonicPrimaryKey]
|
||||
@ -26,6 +29,7 @@ public class Episode
|
||||
public virtual Boolean Ignored { get; set; }
|
||||
|
||||
[SubSonicIgnore]
|
||||
[Ignore]
|
||||
public Boolean IsDailyEpisode
|
||||
{
|
||||
get
|
||||
@ -44,6 +48,7 @@ public Boolean IsDailyEpisode
|
||||
public virtual DateTime? GrabDate { get; set; }
|
||||
|
||||
[SubSonicIgnore]
|
||||
[Ignore]
|
||||
public EpisodeStatusType Status
|
||||
{
|
||||
get
|
||||
@ -68,12 +73,15 @@ public EpisodeStatusType Status
|
||||
}
|
||||
|
||||
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
|
||||
[Ignore]
|
||||
public virtual Series Series { get; set; }
|
||||
|
||||
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
|
||||
[Ignore]
|
||||
public virtual EpisodeFile EpisodeFile { get; set; }
|
||||
|
||||
[SubSonicToManyRelation]
|
||||
[Ignore]
|
||||
public virtual IList<History> Histories { get; protected set; }
|
||||
|
||||
public override string ToString()
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using PetaPoco;
|
||||
using SubSonic.SqlGeneration.Schema;
|
||||
|
||||
namespace NzbDrone.Core.Repository
|
||||
@ -43,6 +44,7 @@ public class Series
|
||||
/// <value><c>true</c> if hidden; otherwise, <c>false</c>.</value>
|
||||
/// <remarks>This field will be used for shows that are pending delete or
|
||||
/// new series that haven't been successfully imported</remarks>
|
||||
[Ignore]
|
||||
public bool Hidden { get; set; }
|
||||
|
||||
public virtual int QualityProfileId { get; set; }
|
||||
@ -54,12 +56,15 @@ public class Series
|
||||
public DateTime? LastDiskSync { get; set; }
|
||||
|
||||
[SubSonicToOneRelation(ThisClassContainsJoinKey = true, JoinKeyName = "QualityProfileId")]
|
||||
[Ignore]
|
||||
public virtual QualityProfile QualityProfile { get; set; }
|
||||
|
||||
[SubSonicToManyRelation]
|
||||
[Ignore]
|
||||
public virtual IList<Episode> Episodes { get; set; }
|
||||
|
||||
[SubSonicToManyRelation]
|
||||
[Ignore]
|
||||
public virtual IList<EpisodeFile> EpisodeFiles { get; protected set; }
|
||||
}
|
||||
}
|
BIN
packages/Castle.Core.2.5.2/Castle.Core.2.5.2.nupkg
vendored
Normal file
BIN
packages/Castle.Core.2.5.2/Castle.Core.2.5.2.nupkg
vendored
Normal file
Binary file not shown.
57
packages/Castle.Core.2.5.2/lib/ASL - Apache Software Foundation License.txt
vendored
Normal file
57
packages/Castle.Core.2.5.2/lib/ASL - Apache Software Foundation License.txt
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
Apache License, Version 2.0
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
55
packages/Castle.Core.2.5.2/lib/BreakingChanges.txt
vendored
Normal file
55
packages/Castle.Core.2.5.2/lib/BreakingChanges.txt
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
================================================================================================
|
||||
change - Removed WebLogger and WebLoggerFactory
|
||||
|
||||
impact - low
|
||||
fixability - medium
|
||||
revision -
|
||||
|
||||
description - To minimize management overhead the classes were removed so that only single
|
||||
Client Profile version of Castle.Core can be distributed.
|
||||
|
||||
fix - You can use NLog or Log4Net web logger integration, or reuse implementation of existing
|
||||
web logger and use it as a custom logger.
|
||||
|
||||
================================================================================================
|
||||
change - Removed obsolete overload of ProxyGenerator.CreateClassProxy
|
||||
|
||||
impact - low
|
||||
fixability - trivial
|
||||
revision -
|
||||
|
||||
description - Deprecated overload of ProxyGenerator.CreateClassProxy was removed to keep the
|
||||
method consistent with other methods and to remove confusion
|
||||
|
||||
fix - whenever removed overload was used, use one of the other overloads.
|
||||
|
||||
================================================================================================
|
||||
change - IProxyGenerationHook.NonVirtualMemberNotification method was renamed
|
||||
|
||||
impact - high
|
||||
fixability - easy
|
||||
revision -
|
||||
|
||||
description - to accommodate class proxies with target method NonVirtualMemberNotification on
|
||||
IProxyGenerationHook type was renamed to more accurate NonProxyableMemberNotification
|
||||
since for class proxies with target not just methods but also fields and other member that
|
||||
break the abstraction will be passed to this method.
|
||||
|
||||
fix - whenever NonVirtualMemberNotification is used/implemented change the method name to
|
||||
NonProxyableMemberNotification. Implementors should also accommodate possibility that not
|
||||
only MethodInfos will be passed as method's second parameter.
|
||||
|
||||
================================================================================================
|
||||
change - DynamicProxy will now allow to intercept members of System.Object
|
||||
|
||||
impact - very low
|
||||
fixability - easy
|
||||
revision -
|
||||
|
||||
description - to allow scenarios like mocking of System.Object members, DynamicProxy will not
|
||||
disallow proxying of these methods anymore. AllMethodsHook (default IProxyGenerationHook)
|
||||
will still filter them out though.
|
||||
|
||||
fix - whenever custom IProxyGenerationHook is used, user should account for System.Object's
|
||||
members being now passed to ShouldInterceptMethod and NonVirtualMemberNotification methods
|
||||
and if neccessary update the code to handle them appropriately.
|
145
packages/Castle.Core.2.5.2/lib/Changes.txt
vendored
Normal file
145
packages/Castle.Core.2.5.2/lib/Changes.txt
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
2.5.2 (2010-11-15)
|
||||
==================
|
||||
- fixed DYNPROXY-150 - Finalizer should not be proxied
|
||||
- implemented DYNPROXY-149 - Make AllMethodsHook members virtual so it can be used as a base class
|
||||
- fixed DYNPROXY-147 - Can't crete class proxies with two non-public methods having same argument types but different return type
|
||||
- fixed DYNPROXY-145 Unable to proxy System.Threading.SynchronizationContext (.NET 4.0)
|
||||
- fixed DYNPROXY-144 - params argument not supported in constructor
|
||||
- fixed DYNPROXY-143 - Permit call to reach "non-proxied" methods of inherited interfaces
|
||||
- implemented DYNPROXY-139 - Better error message
|
||||
- fixed DYNPROXY-133 - Debug assertion in ClassProxyInstanceContributor fails when proxying ISerializable with an explicit implementation of GetObjectData
|
||||
- fixed CORE-32 - Determining if permission is granted via PermissionUtil does not work in .NET 4
|
||||
- applied patch by Alwin Meijs - ExtendedLog4netFactory can be configured with a stream from for example an embedded log4net xml config
|
||||
- Upgraded NLog to 2.0 Beta 1
|
||||
- Added DefaultXmlSerializer to bridge XPathAdapter with standard Xml Serialization.
|
||||
- XPathAdapter for DictionaryAdapter added IXPathSerializer to provide hooks for custom serialization.
|
||||
|
||||
2.5.1 (2010-09-21)
|
||||
==================
|
||||
- Interface proxy with target Interface now accepts null as a valid target value (which can be replaced at a later stage).
|
||||
- DictionaryAdapter behavior overrides are now ordered with all other behaviors
|
||||
- BREAKING CHANGE: removed web logger so that by default Castle.Core works in .NET 4 client profile
|
||||
- added paramter to ModuleScope disabling usage of signed modules. This is to workaround issue DYNPROXY-134. Also a descriptive exception message is being thrown now when the issue is detected.
|
||||
- Added IDictionaryBehaviorBuilder to allow grouping behaviors
|
||||
- Added GenericDictionaryAdapter to simplify generic value sources
|
||||
- fixed issue DYNPROXY-138 - Error message missing space
|
||||
- fixed false positive where DynamicProxy would not let you proxy interface with target interface when target object was a COM object.
|
||||
- fixed ReflectionBasedDictionaryAdapter when using indexed properties
|
||||
|
||||
2.5.0 (2010-08-21)
|
||||
==================
|
||||
- DynamicProxy will now not replicate non-public attribute types
|
||||
- Applied patch from Kenneth Siewers Møller which adds parameterless constructor to DefaultSmtpSender implementation, to be able to configure the inner SmtpClient from the application configuration file (system.net.smtp).
|
||||
- added support for .NET 4 and Silverlight 4, updated solution to VisualStudio 2010
|
||||
- Removed obsolete overload of CreateClassProxy
|
||||
- Added class proxy with taget
|
||||
- Added ability to intercept explicitly implemented generic interface methods on class proxy.
|
||||
- DynamicProxy does not disallow intercepting members of System.Object anymore. AllMethodsHook will still filter them out though.
|
||||
- Added ability to intercept explicitly implemented interface members on class proxy. Does not support generic members.
|
||||
- Merged DynamicProxy into Core binary
|
||||
- fixed DYNPROXY-ISSUE-132 - "MetaProperty equals implementation incorrect"
|
||||
- Fixed bug in DiagnosticsLoggerTestCase, where when running as non-admin, the teardown will throw SecurityException (contributed by maxild)
|
||||
- Split IoC specific classes into Castle.Windsor project
|
||||
- Merged logging services solution
|
||||
- Merged DynamicProxy project
|
||||
|
||||
1.2.0 (2010-01-11)
|
||||
==================
|
||||
|
||||
- Added IEmailSender interface and its default implementation
|
||||
|
||||
1.2.0 beta (2009-12-04)
|
||||
==================
|
||||
|
||||
- BREAKING CHANGE - added ChangeProxyTarget method to IChangeProxyTarget interface
|
||||
- added docs to IChangeProxyTarget methods
|
||||
- Fixed DYNPROXY-ISSUE-108 - Obtaining replicated custom attributes on proxy may fail when property setter throws exception on default value
|
||||
- Moved custom attribute replication from CustomAttributeUtil to new interface - IAttributeDisassembler
|
||||
- Exposed IAttributeDisassembler via ProxyGenerationOptions, so that users can plug their implementation for some convoluted scenarios. (for Silverlight)
|
||||
- Moved IInterceptorSelector from Dynamic Proxy to Core (IOC-ISSUE-156)
|
||||
|
||||
1.1.0 (2009-05-04)
|
||||
==================
|
||||
|
||||
- Applied Eric Hauser's patch fixing CORE-ISSUE-22
|
||||
"Support for environment variables in resource URI"
|
||||
|
||||
- Applied Gauthier Segay's patch fixing CORE-ISSUE-20
|
||||
"Castle.Core.Tests won't build via nant because it use TraceContext without referencing System.Web.dll"
|
||||
|
||||
- Added simple interface to ComponentModel to make optional properties required.
|
||||
|
||||
- Applied Mark's -- <mwatts42@gmail.com> -- patch that changes
|
||||
the Core to support being compiled for Silverlight 2
|
||||
|
||||
- Applied Louis DeJardin's patch adding TraceLogger as a new logger implementation
|
||||
|
||||
- Applied Chris Bilson's patch fixing CORE-15
|
||||
"WebLogger Throws When Logging Outside of an HttpContext"
|
||||
|
||||
Release Candidate 3
|
||||
===================
|
||||
|
||||
- Added IServiceProviderEx which extends IServiceProvider
|
||||
|
||||
- Added Pair<T,S> class.
|
||||
|
||||
- Applied Bill Pierce's patch fixing CORE-9
|
||||
"Allow CastleComponent Attribute to Specify Lifestyle in Constructor"
|
||||
|
||||
- Added UseSingleInterfaceProxy to CompomentModel to control the proxying
|
||||
behavior while maintaining backward compatibility.
|
||||
Added the corresponding ComponentProxyBehaviorAttribute.
|
||||
|
||||
- Made NullLogger and IExtnededLogger
|
||||
|
||||
- Enabled a new format on ILogger interface, with 6 overloads for each method:
|
||||
Debug(string)
|
||||
Debug(string, Exception)
|
||||
Debug(string, params object[])
|
||||
DebugFormat(string, params object[])
|
||||
DebugFormat(Exception, string, params object[])
|
||||
DebugFormat(IFormatProvider, string, params object[])
|
||||
DebugFormat(IFormatProvider, Exception, string, params object[])
|
||||
|
||||
The "FatalError" overloads where marked as [Obsolete], replaced by "Fatal" and "FatalFormat".
|
||||
|
||||
0.0.1.0
|
||||
=======
|
||||
|
||||
- Included IProxyTargetAccessor
|
||||
|
||||
- Removed IMethodInterceptor and IMethodInvocation, that have been replaced
|
||||
by IInterceptor and IInvocation
|
||||
|
||||
- Added FindByPropertyInfo to PropertySetCollection
|
||||
|
||||
- Made the DependencyModel.IsOptional property writable
|
||||
|
||||
- Applied Curtis Schlak's patch fixing IOC-27
|
||||
"assembly resource format only works for resources where the assemblies name and default namespace are the same."
|
||||
|
||||
Quoting:
|
||||
|
||||
"I chose to preserve backwards compatibility by implementing the code in the
|
||||
reverse order as suggested by the reporter. Given the following URI for a resource:
|
||||
|
||||
assembly://my.cool.assembly/context/moo/file.xml
|
||||
|
||||
It will initially look for an embedded resource with the manifest name of
|
||||
"my.cool.assembly.context.moo.file.xml" in the loaded assembly my.cool.assembly.dll.
|
||||
If it does not find it, then it looks for the embedded resource with the manifest name
|
||||
of "context.moo.file.xml".
|
||||
|
||||
- IServiceEnabledComponent Introduced to be used across the project as
|
||||
a standard way to have access to common services, for example, logger factories
|
||||
|
||||
- Added missing log factories
|
||||
|
||||
- Refactor StreamLogger and DiagnosticLogger to be more consistent behavior-wise
|
||||
|
||||
- Refactored WebLogger to extend LevelFilteredLogger (removed duplication)
|
||||
|
||||
- Refactored LoggerLevel order
|
||||
|
||||
- Project started
|
80
packages/Castle.Core.2.5.2/lib/Committers.txt
vendored
Normal file
80
packages/Castle.Core.2.5.2/lib/Committers.txt
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
This file names who's behind the Castle Team. You can find more about us at http://www.castleproject.org/community/team.html
|
||||
|
||||
Committers
|
||||
==========
|
||||
(ordered by the date when joined the project)
|
||||
|
||||
- hammett/Hamilton Verissimo
|
||||
- Henry Conceição
|
||||
- Kevin Williams
|
||||
- Craig Neuwirt
|
||||
- Gilles Bayon
|
||||
- Andrew Hallock
|
||||
- Jason Nelson
|
||||
- Dru Sellers
|
||||
- John Morales
|
||||
- CobraLord
|
||||
- Dan
|
||||
- Tatham Oddie
|
||||
- Fabio David Batista
|
||||
- Chad Humphries
|
||||
- Ayende Rahien
|
||||
- G. Richard Bellamy
|
||||
- Roelof Blom
|
||||
- Ahmed Ghandour
|
||||
- Josh Robb
|
||||
- Ernst Naezer
|
||||
- Marc-Andre Cournoyer
|
||||
- Fabian Schmied
|
||||
- Dave Godfrey
|
||||
- Markus Zywitza
|
||||
- Lee Henson
|
||||
- Ken Egozi
|
||||
- Chris Ortman
|
||||
- Jonathon Rossi
|
||||
- Tuna Toksöz
|
||||
- Krzysztof Kozmic
|
||||
- Mauricio Scheffer
|
||||
- John Simons
|
||||
|
||||
Managers
|
||||
========
|
||||
|
||||
Patch Manager
|
||||
-------------
|
||||
|
||||
- Josh Robb
|
||||
|
||||
Documentation Manager
|
||||
---------------------
|
||||
|
||||
-
|
||||
|
||||
|
||||
PMC Members
|
||||
===========
|
||||
(ordered by the date when joined the PMC)
|
||||
|
||||
- hammett/Hamilton Verissimo (Chair)
|
||||
- Henry Conceição
|
||||
- Kevin Williams
|
||||
- Craig Neuwirt
|
||||
- Gilles Bayon
|
||||
- Chad Humphries
|
||||
- Ayende Rahien
|
||||
- Fabio David Batista
|
||||
- Roelof Blom
|
||||
- Josh Robb
|
||||
- Jonathon Rossi
|
||||
|
||||
Emeritus
|
||||
========
|
||||
(no longer active committers)
|
||||
|
||||
- Gilles Bayon
|
||||
- Dan
|
||||
- Andrew Hallock
|
||||
- John Morales
|
||||
- CobraLord
|
||||
- Tatham Oddie
|
||||
- Ahmed Ghandour
|
BIN
packages/Castle.Core.2.5.2/lib/NET35/Castle.Core.dll
vendored
Normal file
BIN
packages/Castle.Core.2.5.2/lib/NET35/Castle.Core.dll
vendored
Normal file
Binary file not shown.
4927
packages/Castle.Core.2.5.2/lib/NET35/Castle.Core.xml
vendored
Normal file
4927
packages/Castle.Core.2.5.2/lib/NET35/Castle.Core.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Castle.Core.2.5.2/lib/NET40ClientProfile/Castle.Core.dll
vendored
Normal file
BIN
packages/Castle.Core.2.5.2/lib/NET40ClientProfile/Castle.Core.dll
vendored
Normal file
Binary file not shown.
4927
packages/Castle.Core.2.5.2/lib/NET40ClientProfile/Castle.Core.xml
vendored
Normal file
4927
packages/Castle.Core.2.5.2/lib/NET40ClientProfile/Castle.Core.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Castle.Core.2.5.2/lib/SL3/Castle.Core.dll
vendored
Normal file
BIN
packages/Castle.Core.2.5.2/lib/SL3/Castle.Core.dll
vendored
Normal file
Binary file not shown.
4443
packages/Castle.Core.2.5.2/lib/SL3/Castle.Core.xml
vendored
Normal file
4443
packages/Castle.Core.2.5.2/lib/SL3/Castle.Core.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Castle.Core.2.5.2/lib/SL4/Castle.Core.dll
vendored
Normal file
BIN
packages/Castle.Core.2.5.2/lib/SL4/Castle.Core.dll
vendored
Normal file
Binary file not shown.
4443
packages/Castle.Core.2.5.2/lib/SL4/Castle.Core.xml
vendored
Normal file
4443
packages/Castle.Core.2.5.2/lib/SL4/Castle.Core.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
packages/Castle.Core.2.5.2/lib/releaseNotes.txt
vendored
Normal file
8
packages/Castle.Core.2.5.2/lib/releaseNotes.txt
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
You can find full list of changes in changes.txt, list of breaking changes in breakingchanges.txt (there are no known breaking changes between 2.5.1 and 2.5.2 release).
|
||||
|
||||
Issue tracker: - http://issues.castleproject.org/dashboard
|
||||
Documentation (work in progress):
|
||||
Dictionary Adapter - http://stw.castleproject.org/Tools.Castle-DictionaryAdapter.ashx
|
||||
DynamicProxy - http://stw.castleproject.org/Tools.DynamicProxy.ashx
|
||||
Discusssion group: - http://groups.google.com/group/castle-project-users
|
||||
StackOverflow tags: - castle-dynamicproxy, castle-dictionaryadapter, castle
|
32
packages/PetaPoco.4.0.2/Content/Models/Generated/Database.tt
vendored
Normal file
32
packages/PetaPoco.4.0.2/Content/Models/Generated/Database.tt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
<#@ include file="PetaPoco.Core.ttinclude" #>
|
||||
<#
|
||||
// Settings
|
||||
ConnectionStringName = ""; // Uses last connection string in config if not specified
|
||||
Namespace = "";
|
||||
RepoName = "";
|
||||
GenerateOperations = true;
|
||||
GeneratePocos = true;
|
||||
GenerateCommon = true;
|
||||
ClassPrefix = "";
|
||||
ClassSuffix = "";
|
||||
|
||||
// Read schema
|
||||
var tables = LoadTables();
|
||||
|
||||
|
||||
/*
|
||||
// Tweak Schema
|
||||
tables["tablename"].Ignore = true; // To ignore a table
|
||||
tables["tablename"].ClassName = "newname"; // To change the class name of a table
|
||||
tables["tablename"]["columnname"].Ignore = true; // To ignore a column
|
||||
tables["tablename"]["columnname"].PropertyName="newname"; // To change the property name of a column
|
||||
tables["tablename"]["columnname"].PropertyType="bool"; // To change the property type of a column
|
||||
*/
|
||||
|
||||
// Generate output
|
||||
if (tables.Count>0)
|
||||
{
|
||||
#>
|
||||
<#@ include file="PetaPoco.Generator.ttinclude" #>
|
||||
<# } #>
|
||||
|
1615
packages/PetaPoco.4.0.2/Content/Models/Generated/PetaPoco.Core.ttinclude
vendored
Normal file
1615
packages/PetaPoco.4.0.2/Content/Models/Generated/PetaPoco.Core.ttinclude
vendored
Normal file
File diff suppressed because it is too large
Load Diff
136
packages/PetaPoco.4.0.2/Content/Models/Generated/PetaPoco.Generator.ttinclude
vendored
Normal file
136
packages/PetaPoco.4.0.2/Content/Models/Generated/PetaPoco.Generator.ttinclude
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
<#
|
||||
if (string.IsNullOrEmpty(Namespace)) Namespace=ConnectionStringName;
|
||||
if (string.IsNullOrEmpty(RepoName) && !string.IsNullOrEmpty(ConnectionStringName)) RepoName=ConnectionStringName + "DB";
|
||||
if (string.IsNullOrEmpty(Namespace)) Namespace="PetaPoco";
|
||||
if (string.IsNullOrEmpty(RepoName)) RepoName="PetaPocoDB";
|
||||
#>
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using PetaPoco;
|
||||
|
||||
namespace <#=Namespace #>
|
||||
{
|
||||
<# if (GenerateCommon) { #>
|
||||
public partial class <#=RepoName#> : Database
|
||||
{
|
||||
public <#=RepoName#>()
|
||||
: base("<#=ConnectionStringName#>")
|
||||
{
|
||||
CommonConstruct();
|
||||
}
|
||||
|
||||
public <#=RepoName#>(string connectionStringName)
|
||||
: base(connectionStringName)
|
||||
{
|
||||
CommonConstruct();
|
||||
}
|
||||
|
||||
partial void CommonConstruct();
|
||||
|
||||
public interface IFactory
|
||||
{
|
||||
<#=RepoName#> GetInstance();
|
||||
}
|
||||
|
||||
public static IFactory Factory { get; set; }
|
||||
public static <#=RepoName#> GetInstance()
|
||||
{
|
||||
if (_instance!=null)
|
||||
return _instance;
|
||||
|
||||
if (Factory!=null)
|
||||
return Factory.GetInstance();
|
||||
else
|
||||
return new <#=RepoName#>();
|
||||
}
|
||||
|
||||
[ThreadStatic] static <#=RepoName#> _instance;
|
||||
|
||||
public override void OnBeginTransaction()
|
||||
{
|
||||
if (_instance==null)
|
||||
_instance=this;
|
||||
}
|
||||
|
||||
public override void OnEndTransaction()
|
||||
{
|
||||
if (_instance==this)
|
||||
_instance=null;
|
||||
}
|
||||
|
||||
<# if (GenerateOperations) { #>
|
||||
public class Record<T> where T:new()
|
||||
{
|
||||
public static <#=RepoName#> repo { get { return <#=RepoName#>.GetInstance(); } }
|
||||
public bool IsNew() { return repo.IsNew(this); }
|
||||
public void Save() { repo.Save(this); }
|
||||
public object Insert() { return repo.Insert(this); }
|
||||
public int Update() { return repo.Update(this); }
|
||||
public int Delete() { return repo.Delete(this); }
|
||||
public static int Update(string sql, params object[] args) { return repo.Update<T>(sql, args); }
|
||||
public static int Update(Sql sql) { return repo.Update<T>(sql); }
|
||||
public static int Delete(string sql, params object[] args) { return repo.Delete<T>(sql, args); }
|
||||
public static int Delete(Sql sql) { return repo.Delete<T>(sql); }
|
||||
public static int Delete(object primaryKey) { return repo.Delete<T>(primaryKey); }
|
||||
public static bool Exists(object primaryKey) { return repo.Exists<T>(primaryKey); }
|
||||
public static T SingleOrDefault(object primaryKey) { return repo.SingleOrDefault<T>(primaryKey); }
|
||||
public static T SingleOrDefault(string sql, params object[] args) { return repo.SingleOrDefault<T>(sql, args); }
|
||||
public static T SingleOrDefault(Sql sql) { return repo.SingleOrDefault<T>(sql); }
|
||||
public static T FirstOrDefault(string sql, params object[] args) { return repo.FirstOrDefault<T>(sql, args); }
|
||||
public static T FirstOrDefault(Sql sql) { return repo.FirstOrDefault<T>(sql); }
|
||||
public static T Single(object primaryKey) { return repo.Single<T>(primaryKey); }
|
||||
public static T Single(string sql, params object[] args) { return repo.Single<T>(sql, args); }
|
||||
public static T Single(Sql sql) { return repo.Single<T>(sql); }
|
||||
public static T First(string sql, params object[] args) { return repo.First<T>(sql, args); }
|
||||
public static T First(Sql sql) { return repo.First<T>(sql); }
|
||||
public static List<T> Fetch(string sql, params object[] args) { return repo.Fetch<T>(sql, args); }
|
||||
public static List<T> Fetch(Sql sql) { return repo.Fetch<T>(sql); }
|
||||
public static List<T> Fetch(long page, long itemsPerPage, string sql, params object[] args) { return repo.Fetch<T>(page, itemsPerPage, sql, args); }
|
||||
public static List<T> Fetch(long page, long itemsPerPage, Sql sql) { return repo.Fetch<T>(page, itemsPerPage, sql); }
|
||||
public static Page<T> Page(long page, long itemsPerPage, string sql, params object[] args) { return repo.Page<T>(page, itemsPerPage, sql, args); }
|
||||
public static Page<T> Page(long page, long itemsPerPage, Sql sql) { return repo.Page<T>(page, itemsPerPage, sql); }
|
||||
public static IEnumerable<T> Query(string sql, params object[] args) { return repo.Query<T>(sql, args); }
|
||||
public static IEnumerable<T> Query(Sql sql) { return repo.Query<T>(sql); }
|
||||
}
|
||||
<# } #>
|
||||
}
|
||||
<# } #>
|
||||
|
||||
<# if (GeneratePocos) { #>
|
||||
<#
|
||||
foreach(Table tbl in from t in tables where !t.Ignore select t)
|
||||
{
|
||||
#>
|
||||
|
||||
[TableName("<#=tbl.Name#>")]
|
||||
<# if (tbl.PK!=null && tbl.PK.IsAutoIncrement) { #>
|
||||
<# if (tbl.SequenceName==null) { #>
|
||||
[PrimaryKey("<#=tbl.PK.Name#>")]
|
||||
<# } else { #>
|
||||
[PrimaryKey("<#=tbl.PK.Name#>", sequenceName="<#=tbl.SequenceName#>")]
|
||||
<# } #>
|
||||
<# } #>
|
||||
<# if (tbl.PK!=null && !tbl.PK.IsAutoIncrement) { #>
|
||||
[PrimaryKey("<#=tbl.PK.Name#>", autoIncrement=false)]
|
||||
<# } #>
|
||||
[ExplicitColumns]
|
||||
public partial class <#=tbl.ClassName#> <# if (GenerateOperations) { #>: <#=RepoName#>.Record<<#=tbl.ClassName#>> <# } #>
|
||||
{
|
||||
<#
|
||||
foreach(Column col in from c in tbl.Columns where !c.Ignore select c)
|
||||
{
|
||||
// Column bindings
|
||||
#>
|
||||
<# if (col.Name!=col.PropertyName) { #>
|
||||
[Column("<#=col.Name#>")] public <#=col.PropertyType #><#=CheckNullable(col)#> <#=col.PropertyName #> { get; set; }
|
||||
<# } else { #>
|
||||
[Column] public <#=col.PropertyType #><#=CheckNullable(col)#> <#=col.PropertyName #> { get; set; }
|
||||
<# } #>
|
||||
<# } #>
|
||||
}
|
||||
|
||||
<# } #>
|
||||
<# } #>
|
||||
}
|
2186
packages/PetaPoco.4.0.2/Content/Models/PetaPoco.cs
vendored
Normal file
2186
packages/PetaPoco.4.0.2/Content/Models/PetaPoco.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/PetaPoco.4.0.2/PetaPoco.4.0.2.nupkg
vendored
Normal file
BIN
packages/PetaPoco.4.0.2/PetaPoco.4.0.2.nupkg
vendored
Normal file
Binary file not shown.
2186
packages/PetaPoco.Core.4.0.2/Content/Models/PetaPoco.cs
vendored
Normal file
2186
packages/PetaPoco.Core.4.0.2/Content/Models/PetaPoco.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/PetaPoco.Core.4.0.2/PetaPoco.Core.4.0.2.nupkg
vendored
Normal file
BIN
packages/PetaPoco.Core.4.0.2/PetaPoco.Core.4.0.2.nupkg
vendored
Normal file
Binary file not shown.
@ -3,5 +3,4 @@
|
||||
<repository path="..\NzbDrone.Web\packages.config" />
|
||||
<repository path="..\NzbDrone.Core.Test\packages.config" />
|
||||
<repository path="..\NzbDrone.Core\packages.config" />
|
||||
<repository path="..\NzbDrone.Site\packages.config" />
|
||||
</repositories>
|
Loading…
Reference in New Issue
Block a user