diff --git a/Libraries/Siaqodb/siaqodb.XML b/Libraries/Siaqodb/siaqodb.XML
deleted file mode 100644
index 6405a133c..000000000
--- a/Libraries/Siaqodb/siaqodb.XML
+++ /dev/null
@@ -1,636 +0,0 @@
-
-
-
- siaqodb
-
-
-
-
- Attribute to be used for a member of a storable class and that object will be ignored by siaqodb engine
-
-
-
-
- Attribute to be used for a member of type String of a storable class to limit Length of a string object to be stored in database
-
-
-
-
- Create an attribute instance of Type MaxLength
-
- number of characters from string to be stored in database
-
-
-
- Use this attribute if you use a Property and inside that
- property use some complex code and when Siaqodb engine is not able
- to get what is backing field of that Property, variableName is used for Siaqodb engine when that property is used
-
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Do NOT use it!, it is used only internally
-
-
-
-
- Class responsible for configurations of Siaqodb database engine
-
-
-
-
- Add an index for a field or automatic property of a certain Type,an Index can be added also by using Attribute: Sqo.Attributes.Index;
- both ways of adding index are similar
-
- Field name or automatic property name
- Type that declare the field
-
-
-
- Add an UniqueConstraint for a field of a certain Type,an UniqueConstraint can be added also by using Attribute: Sqo.Attributes.UniqueConstraint;
- both ways of adding UniqueConstraint are similar
-
- Field name or automatic property name
- Type that declare the field
-
-
-
- Put MaxLength for a string field or automatic property of a Type, MaxLength can be set also by using Attribute: Sqo.Attributes.MaxLength
-
- Field name or automatic property name
- max length for a string
- Type that declare the field
-
-
-
- Ignore a field or automatic property to be stored
-
- Name of field or automatic property
- Type that declare the field
-
-
-
- Set the name of backing field for a property in case engine cannto discover it, this also can be set by attribute: Sqo.Attributes.UseVariable
-
- Name of property
- Name of backing field of property
-
-
-
-
-
- Set the password for encryption algorithm used to encrypt database data
-
- The password
-
-
-
- Set your custom encryption algorithm that implemets IEncryptor interface
-
- The instance of custom encryption algorithm
-
-
-
- Set build-in encryption algorithm
-
- Encryption algorithm
-
-
-
- Set custom fileName on disk of database file for Type T
-
- Type of objects
- Name of database file on disk
-
-
-
- By default this is true for all types. Set this to false to not load childs entities of objects of Type provided
-
- Type for objects
- true if related object need to be loaded, false if you want to load by Include(...) method
-
-
-
- Set true to raise Loading/Loaded events
-
-
-
-
-
-
- Set if database will be encrypted or not
-
-
-
-
- Database utilities
-
-
-
-
- Rebuild and defragment indexes
-
-
-
-
-
-
- Shrink database files including rawdata.sqr and indexes
-
-
-
-
- Repair database files by fixing corrupted objects bytes
-
-
-
-
-
-
- Repair database file of Type provided, the corrupted objects will be recuperated or deleted
-
-
-
-
-
-
- Normal shrink, all blocks marked as free will be supressed
-
-
-
-
- All database files will be parsed and check if a block can be marked as free then supress free blocks;
- This operation can be slow if your database is big.
-
-
-
-
- This includes Normal + ForceClaimSpace but also shrink of every db file; after this operation OID values of the stored objects may change.
-
-
-
-
- Basic class that any siaqodb storable class may inherits from
-
-
-
-
- Object Identifier(unique per Type)
-
-
-
-
- Main interface to be used by implementers to retrieve objects from database
-
-
-
-
-
-
-
-
-
- Class that describe a field of an object stored in database
-
-
-
-
- Name of field stored in database
-
-
-
-
- Type of field stored in database
-
-
-
-
- Class that describe Type of objects stored in database
-
-
-
-
- Name of Type stored in database
-
-
-
-
- List of fields
-
-
-
-
- Main class of siaqodb database engine responsible for storing, retrieving ,deleting objects on database files
-
-
-
-
- Create a new instance of Siaqodb, database is not opened yet
-
-
-
-
- Create a new instance of Siaqodb and open the database
-
- Physical folder name where objects are stored
-
-
-
- Open database folder
-
- path where objects are stored
-
-
-
- Insert or update object; if object is loaded from database and this method is called then update will occur, if object is new created then insert will occur
-
- Object to be stored
-
-
-
- Insert or update object partially, only provided properties are saved
-
- object of which properties will be stored
- properties to be stored
-
-
-
- Insert or update object partially, only provided properties are saved
-
- object of which properties will be stored
- properties to be stored
- if true,it will store only references to complex objects
-
-
-
- Insert or update object by a Transaction; if object is loaded from database and this method is called then update will occur, if object is new created then insert will occur
-
- Object to be stored
- Transaction object
-
-
-
- Load all objects of Type provided
-
- Type of objects to be loaded from database
- List of objects retrieved from database
-
-
-
- Load object from database by OID provided
-
- The Type of object to be loaded
- oid of object
- the object stored in database with oid provided
-
-
-
- Close database
-
-
-
-
- Cast method to be used in LINQ queries
-
- Type over which LINQ will take action
-
-
-
-
-
- Query method to be used in LINQ queries
-
- Type over which LINQ will take action
-
-
-
-
-
- Load OIDs by expression
-
- Type for which OIDs will be loaded
- filter expression
- List of OIDs
-
-
-
- Load all object OIDs of MetaType provided
-
- meta type Load by method GetAllTypes()
-
-
-
-
-
- Load value of a field of an object identified by OID provided
-
- OID of object
- fieldName
- MetaType
-
-
-
-
-
- Delete an object from database
-
- Object to be deleted
-
-
-
- Delete an object from database using a Transaction
-
- Object to be deleted
- Transaction
-
-
-
- Delete an object from database by a certain field(ex:ID that come from server)
-
- Object to be deleted
- Names of field that this method will lookup for object to delete it
-
-
-
- Delete an object from database by a certain field(ex:ID that come from server)
-
- Object to be deleted
- Names of fields that this method will lookup for object to delete it
-
-
-
- Delete an object from database by a certain field(ex:ID that come from server)
-
- Object to be deleted
- Names of fields that this method will lookup for object to delete it
- Transaction object
-
-
-
- Delete an object from database by a criteria
-
- Pairs of fields-values to lookup for object to delete it
- Number of objects deleted
-
-
-
- Delete all objects of Type provided
-
- Type of objects to be deleted
-
-
-
- Delete all objects of Type provided
-
- Type of objects to be deleted>
-
-
-
- Delete all objects of Type provided
-
- Type of objects to be deleted
- If this is TRUE all dynamic length data associated with objects will be marked as free and Shrink method is able to free the space
-
-
-
- Return all Types from database folder
-
- List of MetaType objects
-
-
-
- Return number of objects of Type provided
-
- Type of objects
-
-
-
-
-
- Export to XML all objects of Type provided from database
-
- Type of objects to be exported
- XmlWriter
-
-
-
- Export to XML list of objects provided
-
- Type of objects
- XmlWriter
- list of objects to be exported
-
-
-
- Import from XML objects and return a list of them
-
- Type of objects to be imported
- XmlReader
- List of objects imported
-
-
-
- Import from XML objects and return a list and save into database
-
- Type of objects to be imported
- XmlReader
- if TRUE objects are saved also in database
- List of objects imported
-
-
-
- this method is obsolete Use SiaqodbConfigurator.SetDatabaseFileName() method
-
- type
- fielName
-
-
-
- Update an object in database by a certain Field(eq: ID that come from a server)
-
- FieldName by which update is made(eq an ID)
- object that has all values but not OID to update it in database
- true if object was updated and false if object was not found in database
-
-
-
- Update an object in database by certain Fields(eq: ID that come from a server)
-
- name of fields by which update is made(eq an ID)
- object that has all values but not OID to update it in database
- true if object was updated and false if object was not found in database
-
-
-
- Update an object in database by certain Fields(eq: ID that come from a server)
-
- name of fields by which update is made(eq an ID)
- object that has all values but not OID to update it in database
- Transaction object
- true if object was updated and false if object was not found in database
-
-
-
- return current database path
-
- The database folder path
-
-
-
- Start a database Transaction to be used on insert/update/delete objects
-
- Transaction object
-
-
-
- Get a list of unique values for a field index
-
- Type where index is defined
- Type of field indexed
- Name of field or automatic property which is indexed
-
-
-
-
-
- Load all objects in Lazy mode, objects are activated/read from db when it is accessed
- by index or by enumerator
-
- Type of objects to be loaded from database
- LazyObjectList of objects
-
-
-
- Get OID of object, if the Type of object has not defined OID property then object and OID are weak cached during object load from database and this value is returned,
- otherwise it is returned value of the OID property
-
- The object for which OID is returned
- The OID associated with object that is stored in database
-
-
-
- Raised before an object is saved in database
-
-
-
-
- Raised after an object is saved in database
-
-
-
-
- Raised before an object is deleted from database
-
-
-
-
- Raised after an object is deleted from database
-
-
-
-
- Raised before an object is loaded from database
-
-
-
-
- Raised after object is loaded from database
-
-
-
-
- List used to retrieve objects from database
-
- Type of objects from list
-
-
-
- Add obeject of Type T in the list
-
- object to be added
-
-
-
- Remove all elements from list
-
-
-
-
- Determines if an element is in list
-
- The object to locate in list
- bool value if object was found or not
-
-
-
- Remove object from list
-
- The object to remove
- bool value if object was removed or not
-
-
-
- Commit transaction to database
-
-
-
-
- Rollback changes
-
-
-
-
\ No newline at end of file
diff --git a/Libraries/Siaqodb/siaqodb.dll b/Libraries/Siaqodb/siaqodb.dll
deleted file mode 100644
index 872d240fb..000000000
Binary files a/Libraries/Siaqodb/siaqodb.dll and /dev/null differ
diff --git a/NzbDrone.Console/NzbDrone.Console.csproj b/NzbDrone.Console/NzbDrone.Console.csproj
index a2de9bfb2..595e60473 100644
--- a/NzbDrone.Console/NzbDrone.Console.csproj
+++ b/NzbDrone.Console/NzbDrone.Console.csproj
@@ -65,10 +65,6 @@
OnOutputUpdated
-
- False
- ..\Libraries\Siaqodb\siaqodb.dll
-
@@ -122,11 +118,6 @@
NzbDrone.ico
-
-
- licenses.licx
-
-
diff --git a/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs b/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs
index a940bbe84..581191620 100644
--- a/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs
+++ b/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs
@@ -9,7 +9,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.Configuration
{
[TestFixture]
- public class ConfigServiceFixture : ObjectDbTest
+ public class ConfigServiceFixture : DbTest
{
[SetUp]
public void SetUp()
diff --git a/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs b/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs
index ff9e009ca..5970c9b46 100644
--- a/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs
+++ b/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.Datastore
}
[TestFixture]
- public class BasicRepositoryFixture : ObjectDbTest,BaiscType>
+ public class BasicRepositoryFixture : DbTest,BaiscType>
{
private BaiscType _baiscType;
diff --git a/NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs b/NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs
index de8726eee..b6d11a31e 100644
--- a/NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs
+++ b/NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs
@@ -10,245 +10,119 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Datastore
{
[TestFixture]
- public class ObjectDatabaseFixture : ObjectDbTest
+ public class ObjectDatabaseFixture : DbTest, BaiscType>
{
- private ChildModel _childModel;
- private ParentModel _parentModel;
+ private BaiscType _sampleType;
[SetUp]
public void SetUp()
{
- _childModel = Builder
+ _sampleType = Builder
.CreateNew()
.With(s => s.Id = 0)
.Build();
-
- _parentModel = Builder
- .CreateNew()
- .With(e => e.Id = 0)
- .Build();
-
}
[Test]
public void should_be_able_to_write_to_database()
{
- Db.Insert(_childModel);
- Db.AsQueryable().Should().HaveCount(1);
+ Subject.Insert(_sampleType);
+ Db.All().Should().HaveCount(1);
}
[Test]
public void double_insert_should_fail()
{
- Db.Insert(_childModel);
- Assert.Throws(() => Db.Insert(_childModel));
+ Subject.Insert(_sampleType);
+ Assert.Throws(() => Subject.Insert(_sampleType));
}
[Test]
public void update_item_with_root_index_0_should_faile()
{
- _childModel.Id = 0;
- Assert.Throws(() => Db.Update(_childModel));
+ _sampleType.Id = 0;
+ Assert.Throws(() => Subject.Update(_sampleType));
}
-
[Test]
public void should_be_able_to_store_empty_list()
{
- var series = new List();
-
- Db.InsertMany(series);
- }
-
- [Test]
- public void should_not_store_dirty_data_in_cache()
- {
- Db.Insert(_parentModel);
-
- Db.AsQueryable().Single().Child.Should().BeNull();
-
- _parentModel.Child = Builder.CreateNew().Build();
-
- Db.AsQueryable().Single().Child.Should().BeNull();
- }
-
- [Test]
- public void should_store_nested_objects()
- {
- _parentModel.Child = _childModel;
-
- Db.Insert(_parentModel);
-
- Db.AsQueryable().Should().HaveCount(1);
- Db.AsQueryable().Single().Child.Should().NotBeNull();
- }
-
- [Test]
- public void should_update_nested_objects()
- {
- _parentModel.Child = Builder
- .CreateNew()
- .With(s => s.Id = 0)
- .Build();
-
- Db.Insert(_parentModel);
+ var series = new List();
- _parentModel.Child.A = "UpdatedTitle";
-
- Db.Update(_parentModel);
-
- Db.AsQueryable().Should().HaveCount(1);
- Db.AsQueryable().Single().Child.Should().NotBeNull();
- Db.AsQueryable().Single().Child.A.Should().Be("UpdatedTitle");
+ Subject.InsertMany(series);
}
[Test]
public void new_objects_should_get_id()
{
- _childModel.Id = 0;
- Db.Insert(_childModel);
- _childModel.Id.Should().NotBe(0);
+ _sampleType.Id = 0;
+ Subject.Insert(_sampleType);
+ _sampleType.Id.Should().NotBe(0);
}
[Test]
public void new_object_should_get_new_id()
{
- _childModel.Id = 0;
- Db.Insert(_childModel);
+ _sampleType.Id = 0;
+ Subject.Insert(_sampleType);
- Db.AsQueryable().Should().HaveCount(1);
- _childModel.Id.Should().Be(1);
+ Db.All().Should().HaveCount(1);
+ _sampleType.Id.Should().Be(1);
}
- [Test]
- public void should_be_able_to_assign_ids_to_nested_objects()
- {
- var nested = new NestedModel();
-
- nested.List.Add(new NestedModel());
-
- Db.Insert(nested);
- nested.Id.Should().Be(1);
- nested.List.Should().OnlyContain(c => c.Id > 0);
- }
[Test]
public void should_have_id_when_returned_from_database()
{
- _childModel.Id = 0;
- Db.Insert(_childModel);
- var item = Db.AsQueryable();
+ _sampleType.Id = 0;
+ Subject.Insert(_sampleType);
+ var item = Db.All();
item.Should().HaveCount(1);
item.First().Id.Should().NotBe(0);
item.First().Id.Should().BeLessThan(100);
- item.First().Id.Should().Be(_childModel.Id);
+ item.First().Id.Should().Be(_sampleType.Id);
}
[Test]
public void should_be_able_to_find_object_by_id()
{
- Db.Insert(_childModel);
- var item = Db.AsQueryable().Single(c => c.Id == _childModel.Id);
+ Subject.Insert(_sampleType);
+ var item = Db.All().Single(c => c.Id == _sampleType.Id);
item.Id.Should().NotBe(0);
- item.Id.Should().Be(_childModel.Id);
- }
-
- [Test]
- public void deleting_child_model_directly_should_set_link_to_null()
- {
- _parentModel.Child = _childModel;
-
- Db.Insert(_childModel);
- Db.Insert(_parentModel);
-
- Db.AsQueryable().Single().Child.Should().NotBeNull();
-
- Db.Delete(_childModel);
-
- Db.AsQueryable().Single().Child.Should().BeNull();
+ item.Id.Should().Be(_sampleType.Id);
}
- [Test]
- public void deleting_child_model_directly_should_remove_item_from_child_list()
- {
-
- var children = Builder.CreateListOfSize(5)
- .All()
- .With(c => c.Id = 0)
- .Build();
-
- _parentModel.ChildList = children.ToList();
-
- Db.Insert(_parentModel);
-
- Db.AsQueryable().Single().ChildList.Should().HaveSameCount(children);
-
- Db.Delete(children[1]);
-
- Db.AsQueryable().Single().ChildList.Should().HaveCount(4);
- }
[Test]
public void update_field_should_only_update_that_filed()
{
- var childModel = new ChildModel
+ var childModel = new BaiscType
{
- A = "A_Original",
- B = 1,
- C = 1
+ Address = "Address",
+ Name = "Name",
+ Tilte = "Title"
};
- Db.Insert(childModel);
+ Subject.Insert(childModel);
- childModel.A = "A_New";
- childModel.B = 2;
- childModel.C = 2;
+ childModel.Address = "A";
+ childModel.Name = "B";
+ childModel.Tilte = "C";
- Db.UpdateField(childModel, "B");
+ Subject.UpdateOnly(childModel, t=>t.Name);
- Db.AsQueryable().Single().A.Should().Be("A_Original");
- Db.AsQueryable().Single().B.Should().Be(2);
- Db.AsQueryable().Single().C.Should().Be(1);
+ Db.All().Single().Address.Should().Be("Address");
+ Db.All().Single().Name.Should().Be("B");
+ Db.All().Single().Tilte.Should().Be("Title");
}
- [Test]
- public void should_be_able_to_read_unknown_type()
- {
- Db.AsQueryable().ToList().Should().BeEmpty();
- }
- }
-
- public class UnknownType : ModelBase
- {
- public string Field1 { get; set; }
- }
-
- public class NestedModel : ModelBase
- {
- public NestedModel()
- {
- List = new List { this };
- }
-
- public List List { get; set; }
- }
- public class ParentModel : ModelBase
- {
- public ChildModel Child { get; set; }
- public List ChildList { get; set; }
}
- public class ChildModel : ModelBase
- {
- public String A { get; set; }
- public int B { get; set; }
- public int C { get; set; }
- }
}
diff --git a/NzbDrone.Core.Test/EpisodeParseResultTest.cs b/NzbDrone.Core.Test/EpisodeParseResultTest.cs
index 4b9a897be..8f55ef387 100644
--- a/NzbDrone.Core.Test/EpisodeParseResultTest.cs
+++ b/NzbDrone.Core.Test/EpisodeParseResultTest.cs
@@ -202,7 +202,7 @@ namespace NzbDrone.Core.Test
public string create_proper_sab_daily_titles(bool proper)
{
var series = Builder.CreateNew()
- .With(c => c.SeriesTypes = SeriesTypes.Daily)
+ .With(c => c.SeriesType = SeriesTypes.Daily)
.With(c => c.Title = "My Series Name")
.Build();
diff --git a/NzbDrone.Core.Test/Framework/ObjectDbTest.cs b/NzbDrone.Core.Test/Framework/DbTest.cs
similarity index 52%
rename from NzbDrone.Core.Test/Framework/ObjectDbTest.cs
rename to NzbDrone.Core.Test/Framework/DbTest.cs
index 0d5e372e2..c82a18d6f 100644
--- a/NzbDrone.Core.Test/Framework/ObjectDbTest.cs
+++ b/NzbDrone.Core.Test/Framework/DbTest.cs
@@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
-using System.IO;
+using System.Data;
using System.Linq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Datastore;
+using ServiceStack.OrmLite;
namespace NzbDrone.Core.Test.Framework
{
- public abstract class ObjectDbTest : ObjectDbTest
+ public abstract class DbTest : DbTest
where TSubject : class
where TModel : ModelBase, new()
{
@@ -54,11 +55,14 @@ namespace NzbDrone.Core.Test.Framework
}
}
- public abstract class ObjectDbTest : CoreTest
+
+
+
+ public abstract class DbTest : CoreTest
{
- private IObjectDatabase _db;
- protected IObjectDatabase Db
+ private IDatabase _db;
+ protected IDatabase Db
{
get
{
@@ -71,7 +75,8 @@ namespace NzbDrone.Core.Test.Framework
private void WithObjectDb(bool memory = true)
{
- _db = new SiaqoDbFactory(new DiskProvider(), new EnvironmentProvider()).Create(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString()));
+ var factory = new DbFactory(new EnvironmentProvider());
+ _db = new TestDatabase(factory.Create());
Mocker.SetConstant(Db);
}
@@ -81,13 +86,51 @@ namespace NzbDrone.Core.Test.Framework
WithObjectDb();
}
- [TearDown]
- public void ObjectDbTearDown()
+
+ }
+
+
+ public interface IDatabase
+ {
+ void InsertMany(IEnumerable items) where T : new();
+ void Insert(T item) where T : new();
+ IEnumerable All() where T : new();
+ void Update(T childModel) where T : new();
+ void Delete(T childModel) where T : new();
+ }
+
+ public class TestDatabase : IDatabase
+ {
+ private readonly IDbConnection _dbConnection;
+
+ public TestDatabase(IDbConnection dbConnection)
{
- if (_db != null)
- {
- _db.Dispose();
- }
+ _dbConnection = dbConnection;
+ }
+
+ public void InsertMany(IEnumerable items) where T : new()
+ {
+ _dbConnection.InsertAll(items);
+ }
+
+ public void Insert(T item) where T : new()
+ {
+ _dbConnection.Insert(item);
+ }
+
+ public IEnumerable All() where T : new()
+ {
+ return _dbConnection.Select();
+ }
+
+ public void Update(T childModel) where T : new()
+ {
+ _dbConnection.Update(childModel);
+ }
+
+ public void Delete(T childModel) where T : new()
+ {
+ _dbConnection.Delete(childModel);
}
}
}
\ No newline at end of file
diff --git a/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs b/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs
index 93ca0fb4e..dfa4cce1d 100644
--- a/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs
+++ b/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs
@@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HistoryTests
{
[TestFixture]
- public class HistoryServiceTest : ObjectDbTest
+ public class HistoryServiceTest : DbTest
{
[Test]
public void Trim_Items()
diff --git a/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs b/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs
index cdd04ede5..d9a66b371 100644
--- a/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs
+++ b/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs
@@ -13,7 +13,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.InstrumentationTests
{
[TestFixture]
- public class DatabaseTargetFixture : ObjectDbTest
+ public class DatabaseTargetFixture : DbTest
{
string _loggerName;
diff --git a/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs b/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs
index 66a070e5c..c17774ec1 100644
--- a/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs
+++ b/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs
@@ -18,7 +18,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.JobTests
{
[TestFixture]
- public class JobRepositoryFixture : ObjectDbTest
+ public class JobRepositoryFixture : DbTest
{
FakeJob _fakeJob;
DisabledJob _disabledJob;
diff --git a/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs b/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs
index 4615a3091..865f2d88d 100644
--- a/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs
+++ b/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs
@@ -9,7 +9,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.MediaFileTests
{
[TestFixture]
- public class MediaFileRepositoryFixture : ObjectDbTest
+ public class MediaFileRepositoryFixture : DbTest
{
[Test]
public void get_files_by_series()
diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
index 5be2117b0..2ba22eb93 100644
--- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
+++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
@@ -93,6 +93,9 @@
..\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Configuration.dll
+
+ ..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\Mono.Data.Sqlite.dll
+ ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll
@@ -115,6 +118,26 @@
False..\packages\Prowlin.0.9.4456.26422\lib\net40\Prowlin.dll
+
+ False
+ ..\packages\ServiceStack.Common.3.9.42\lib\net35\ServiceStack.Common.dll
+
+
+ ..\packages\ServiceStack.Common.3.9.42\lib\net35\ServiceStack.Interfaces.dll
+ True
+
+
+ ..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.dll
+ True
+
+
+ ..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.Sqlite.dll
+ True
+
+
+ False
+ ..\packages\ServiceStack.Text.3.9.42\lib\net35\ServiceStack.Text.dll
+ False..\packages\SignalR.Server.0.5.3\lib\net40\SignalR.dll
@@ -134,7 +157,7 @@
-
+
@@ -293,6 +316,9 @@
Always
+
+
+ Always
diff --git a/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
index 0e810bc87..4f8ae9c40 100644
--- a/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
+++ b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.IO;
using FizzWare.NBuilder;
using FluentAssertions;
+using Moq;
using NUnit.Framework;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
@@ -774,7 +775,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
var series = Builder
.CreateNew()
- .With(s => s.SeriesTypes = SeriesTypes.Daily)
+ .With(s => s.SeriesType = SeriesTypes.Daily)
.With(s => s.Title = "The Daily Show with Jon Stewart")
.Build();
@@ -803,7 +804,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
var series = Builder
.CreateNew()
- .With(s => s.SeriesTypes = SeriesTypes.Daily)
+ .With(s => s.SeriesType = SeriesTypes.Daily)
.With(s => s.Title = "The Daily Show with Jon Stewart")
.Build();
@@ -832,7 +833,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
var series = Builder
.CreateNew()
- .With(s => s.SeriesTypes = SeriesTypes.Daily)
+ .With(s => s.SeriesType = SeriesTypes.Daily)
.With(s => s.Title = "The Daily Show with Jon Stewart")
.Build();
diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs
index 8de8dd989..7ab472114 100644
--- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs
+++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs
@@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
{
_series = Builder
.CreateNew()
- .With(s => s.SeriesTypes = SeriesTypes.Standard)
+ .With(s => s.SeriesType = SeriesTypes.Standard)
.Build();
}
@@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
public void WithDailySeries()
{
- _series.SeriesTypes = SeriesTypes.Daily;
+ _series.SeriesType = SeriesTypes.Daily;
}
[Test]
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs
index 94c5cedd3..554f78fa8 100644
--- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs
+++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs
@@ -148,7 +148,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
{
Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false },
AirDate = new DateTime(2011, 12, 01),
- Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesTypes = SeriesTypes.Daily },
+ Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesType = SeriesTypes.Daily },
};
diff --git a/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs
index 65b49f8e5..d62941ce5 100644
--- a/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs
+++ b/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.ProviderTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
- public class SceneMappingProviderTest : ObjectDbTest
+ public class SceneMappingProviderTest : DbTest
{
private const string SceneMappingUrl = "http://services.nzbdrone.com/SceneMapping/Active";
diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs
index 733c934cc..8d4718022 100644
--- a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs
+++ b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs
@@ -11,7 +11,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
- public class GetEpisodeBySceneNumberFixture : ObjectDbTest
+ public class GetEpisodeBySceneNumberFixture : DbTest
{
private Series _series;
private Episode _episode;
diff --git a/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs b/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs
index f5bf689e3..e241ffb76 100644
--- a/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs
+++ b/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs
@@ -13,7 +13,7 @@ namespace NzbDrone.Core.Test.TvTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
- public class SeasonProviderTest : ObjectDbTest
+ public class SeasonProviderTest : DbTest
{
[SetUp]
public void Setup()
diff --git a/NzbDrone.Core.Test/packages.config b/NzbDrone.Core.Test/packages.config
index 03b747121..75d53ccde 100644
--- a/NzbDrone.Core.Test/packages.config
+++ b/NzbDrone.Core.Test/packages.config
@@ -11,6 +11,9 @@
+
+
+
\ No newline at end of file
diff --git a/NzbDrone.Core.Test/sqlite/x86/sqlite3.dll b/NzbDrone.Core.Test/sqlite/x86/sqlite3.dll
new file mode 100644
index 000000000..45b2e4eb3
Binary files /dev/null and b/NzbDrone.Core.Test/sqlite/x86/sqlite3.dll differ
diff --git a/NzbDrone.Core.Test/sqlite/x86/sqlite3.exe b/NzbDrone.Core.Test/sqlite/x86/sqlite3.exe
new file mode 100644
index 000000000..cd3329063
Binary files /dev/null and b/NzbDrone.Core.Test/sqlite/x86/sqlite3.exe differ
diff --git a/NzbDrone.Core/Configuration/ConfigRepository.cs b/NzbDrone.Core/Configuration/ConfigRepository.cs
index e2a559d41..3c282dee6 100644
--- a/NzbDrone.Core/Configuration/ConfigRepository.cs
+++ b/NzbDrone.Core/Configuration/ConfigRepository.cs
@@ -1,3 +1,4 @@
+using System.Data;
using System.Linq;
using NzbDrone.Core.Datastore;
@@ -11,15 +12,15 @@ namespace NzbDrone.Core.Configuration
public class ConfigRepository : BasicRepository, IConfigRepository
{
- public ConfigRepository(IObjectDatabase objectDatabase)
- : base(objectDatabase)
+ public ConfigRepository(IDbConnection database)
+ : base(database)
{
}
public Config Get(string key)
{
- return Queryable.SingleOrDefault(c => c.Key == key);
+ return SingleOrDefault(c => c.Key == key);
}
diff --git a/NzbDrone.Core/ContainerExtensions.cs b/NzbDrone.Core/ContainerExtensions.cs
index 111677586..f9147ac34 100644
--- a/NzbDrone.Core/ContainerExtensions.cs
+++ b/NzbDrone.Core/ContainerExtensions.cs
@@ -1,7 +1,5 @@
-using System.Collections.Generic;
-using System.Data;
+using System.Data;
using System.IO;
-using System.Linq;
using System.Reflection;
using Autofac;
using NLog;
@@ -63,12 +61,11 @@ namespace NzbDrone.Core
return c.Resolve().Create();
}).As().SingleInstance();
- container.RegisterGeneric(typeof(BasicDb<>)).As(typeof(IBasicDb<>));
container.Register(c =>
{
- return c.Resolve().Create();
- }).As().SingleInstance();
+ return c.Resolve().Create();
+ }).As().SingleInstance();
container.RegisterGeneric(typeof(BasicRepository<>)).As(typeof(IBasicRepository<>));
diff --git a/NzbDrone.Core/Datastore/BasicDb.cs b/NzbDrone.Core/Datastore/BasicDb.cs
deleted file mode 100644
index 90cd6a6e0..000000000
--- a/NzbDrone.Core/Datastore/BasicDb.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using ServiceStack.OrmLite;
-
-namespace NzbDrone.Core.Datastore
-{
- public interface IBasicDb where TModel : ModelBase, new()
- {
- IEnumerable All();
- int Count();
- TModel Get(int id);
- //TModel Single();
- //TModel SingleOrDefault();
- TModel Insert(TModel model);
- TModel Update(TModel model);
- TModel Upsert(TModel model);
- void Delete(int id);
- void Delete(TModel model);
- void InsertMany(IList models);
- void UpdateMany(IList models);
- void DeleteMany(List models);
- void Purge();
- bool HasItems();
- }
-
- public class BasicDb : IBasicDb where TModel : ModelBase, new()
- {
- public BasicDb(IDbConnection database)
- {
- Database = database;
- }
-
- public IDbConnection Database { get; private set; }
-
- public IEnumerable All()
- {
- return Database.Select();
- }
-
- public int Count()
- {
- return (int)Database.Count();
- }
-
- public TModel Get(int id)
- {
- return Database.GetById(id);
- }
-
- //public TModel Single()
- //{
- // return Queryable.Single();
- //}
-
- //public TModel SingleOrDefault()
- //{
- // return Queryable.SingleOrDefault();
- //}
-
- public TModel Insert(TModel model)
- {
- Database.Insert(model);
- model.Id = (int)Database.GetLastInsertId();
- return model;
- }
-
- public TModel Update(TModel model)
- {
- Database.Update(model);
- return model;
- }
-
- public void Delete(TModel model)
- {
- Database.Delete(model);
- }
-
- public void InsertMany(IList models)
- {
- Database.InsertAll(models);
- }
-
- public void UpdateMany(IList models)
- {
- Database.UpdateAll(models);
- }
-
- public void DeleteMany(List models)
- {
- Database.DeleteAll(models);
- }
-
- public TModel Upsert(TModel model)
- {
- if (model.Id == 0)
- {
- Database.Insert(model);
- model.Id = (int)Database.GetLastInsertId();
- return model;
- }
- Database.Update(model);
- return model;
- }
-
- public void Delete(int id)
- {
- Database.DeleteById(id);
- }
-
- public void DeleteMany(IEnumerable ids)
- {
- Database.DeleteByIds(ids);
- }
-
- public void Purge()
- {
- Database.DeleteAll();
- }
-
- public bool HasItems()
- {
- return Count() > 0;
- }
- }
-}
diff --git a/NzbDrone.Core/Datastore/BasicRepository.cs b/NzbDrone.Core/Datastore/BasicRepository.cs
index 740092a67..fb5c06970 100644
--- a/NzbDrone.Core/Datastore/BasicRepository.cs
+++ b/NzbDrone.Core/Datastore/BasicRepository.cs
@@ -1,5 +1,10 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Data;
using System.Linq;
+using System.Linq.Expressions;
+using NzbDrone.Core.Tv;
+using ServiceStack.OrmLite;
namespace NzbDrone.Core.Datastore
{
@@ -8,117 +13,142 @@ namespace NzbDrone.Core.Datastore
IEnumerable All();
int Count();
TModel Get(int id);
- TModel Single();
+ TModel Single(Expression> predicate);
TModel SingleOrDefault();
+ TModel SingleOrDefault(Expression> predicate);
+ List Where(Expression> predicate);
TModel Insert(TModel model);
TModel Update(TModel model);
- TModel UpSert(TModel model);
+ TModel Upsert(TModel model);
void Delete(int id);
void Delete(TModel model);
- IList InsertMany(IList model);
- IList UpdateMany(IList model);
+ void InsertMany(IList model);
+ void UpdateMany(IList model);
void DeleteMany(List model);
void Purge();
bool HasItems();
+ void DeleteMany(IEnumerable ids);
+ void UpdateOnly(TModel model, Expression> onlyFields);
}
public class BasicRepository : IBasicRepository where TModel : ModelBase, new()
{
- public BasicRepository(IObjectDatabase objectDatabase)
+ public BasicRepository(IDbConnection database)
{
- ObjectDatabase = objectDatabase;
+ Database = database;
}
- public IObjectDatabase ObjectDatabase { get; private set; }
-
- protected IEnumerable Queryable { get { return ObjectDatabase.AsQueryable(); } }
+ public IDbConnection Database { get; private set; }
public IEnumerable All()
{
- return Queryable.ToList();
+ return Database.Select();
}
public int Count()
{
- return Queryable.Count();
+ return (int)Database.Count();
}
public TModel Get(int id)
{
- return Queryable.Single(c => c.Id == id);
+ return Database.GetById(id);
}
- public TModel Single()
+ public TModel Single(Expression> predicate)
{
- return Queryable.Single();
+ return Database.Select(predicate).Single();
}
public TModel SingleOrDefault()
{
- return Queryable.SingleOrDefault();
+ return All().Single();
+ }
+
+ public TModel Single()
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public TModel SingleOrDefault(Expression> predicate)
+ {
+ return Database.Select(predicate).SingleOrDefault();
+ }
+
+ public List Where(Expression> predicate)
+ {
+ return Database.Select(predicate);
}
public TModel Insert(TModel model)
{
- return ObjectDatabase.Insert(model);
+ Database.Insert(model);
+ model.Id = (int)Database.GetLastInsertId();
+ return model;
}
public TModel Update(TModel model)
{
- return ObjectDatabase.Update(model);
+ Database.Update(model);
+ return model;
}
+
public void Delete(TModel model)
{
- ObjectDatabase.Delete(model);
+ Database.Delete(model);
}
- public IList InsertMany(IList model)
+ public void InsertMany(IList models)
{
- return ObjectDatabase.InsertMany(model);
+ Database.InsertAll(models);
}
- public IList UpdateMany(IList model)
+ public void UpdateMany(IList models)
{
- return ObjectDatabase.UpdateMany(model);
+ Database.UpdateAll(models);
}
- public void DeleteMany(List model)
+ public void DeleteMany(List models)
{
- ObjectDatabase.DeleteMany(model);
+ Database.DeleteAll(models);
}
- public TModel UpSert(TModel model)
+ public TModel Upsert(TModel model)
{
if (model.Id == 0)
{
- return ObjectDatabase.Insert(model);
+ Database.Insert(model);
+ model.Id = (int)Database.GetLastInsertId();
+ return model;
}
- return ObjectDatabase.Update(model);
+ Database.Update(model);
+ return model;
}
public void Delete(int id)
{
- var itemToDelete = Get(id);
- ObjectDatabase.Delete(itemToDelete);
+ Database.DeleteById(id);
}
public void DeleteMany(IEnumerable ids)
{
- foreach (var id in ids)
- {
- Delete(id);
- }
+ Database.DeleteByIds(ids);
}
public void Purge()
{
- DeleteMany(Queryable.Select(c => c.Id));
+ Database.DeleteAll();
}
public bool HasItems()
{
- return Queryable.Any();
+ return Count() > 0;
+ }
+
+ public void UpdateOnly(TModel model, Expression> onlyFields)
+ {
+ Database.UpdateOnly(model, onlyFields);
}
}
}
diff --git a/NzbDrone.Core/Datastore/DbFactory.cs b/NzbDrone.Core/Datastore/DbFactory.cs
index 17fb3796f..c14893869 100644
--- a/NzbDrone.Core/Datastore/DbFactory.cs
+++ b/NzbDrone.Core/Datastore/DbFactory.cs
@@ -1,6 +1,5 @@
using System;
using System.Data;
-using System.Linq;
using NzbDrone.Common;
using ServiceStack.OrmLite;
@@ -28,7 +27,7 @@ namespace NzbDrone.Core.Datastore
}
var dbFactory = new OrmLiteConnectionFactory(GetConnectionString(dbPath));
- return dbFactory.OpenDbConnection();
+ return dbFactory.Open();
}
private string GetConnectionString(string dbPath)
diff --git a/NzbDrone.Core/Datastore/ObjectDbFactory.cs b/NzbDrone.Core/Datastore/ObjectDbFactory.cs
deleted file mode 100644
index c76c81614..000000000
--- a/NzbDrone.Core/Datastore/ObjectDbFactory.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Linq;
-using NzbDrone.Common;
-using Sqo;
-
-namespace NzbDrone.Core.Datastore
-{
- public interface IObjectDbFactory
- {
- IObjectDatabase Create(string dbPath = null);
- }
-
- public class SiaqoDbFactory : IObjectDbFactory
- {
- private readonly DiskProvider _diskProvider;
- private readonly EnvironmentProvider _environmentProvider;
-
- public SiaqoDbFactory(DiskProvider diskProvider, EnvironmentProvider environmentProvider)
- {
- _diskProvider = diskProvider;
- _environmentProvider = environmentProvider;
- }
-
- public IObjectDatabase Create(string dbPath = null)
- {
- if (string.IsNullOrWhiteSpace(dbPath))
- {
- dbPath = _environmentProvider.GetObjectDbFolder();
- }
-
- if (!_diskProvider.FolderExists(dbPath))
- {
- _diskProvider.CreateDirectory(dbPath);
- }
-
- var db = new Siaqodb(dbPath);
-
- return new SiaqodbProxy(db);
- }
- }
-}
diff --git a/NzbDrone.Core/Datastore/Relators/EpisodeFileEpisodeRelator.cs b/NzbDrone.Core/Datastore/Relators/EpisodeFileEpisodeRelator.cs
deleted file mode 100644
index 6c7aa9121..000000000
--- a/NzbDrone.Core/Datastore/Relators/EpisodeFileEpisodeRelator.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using NzbDrone.Core.Repository;
-
-namespace NzbDrone.Core.Datastore.Relators
-{
- public class EpisodeFileEpisodeRelator
- {
-
- private EpisodeFile _current;
- public EpisodeFile MapIt(EpisodeFile episodeFile, Series series, Episode episode)
- {
- // Terminating call. Since we can return null from this function
- // we need to be ready for PetaPoco to callback later with null
- // parameters
- if (episodeFile == null)
- return _current;
-
- // Is this the same EpisodeFile as the current one we're processing
- if (_current != null && _current.EpisodeFileId == episodeFile.EpisodeFileId)
- {
- // Yes, just add this post to the current EpisodeFiles's collection of Episodes
- _current.Episodes.Add(episode);
-
- // Return null to indicate we're not done with this EpisodeFiles yet
- return null;
- }
-
- // This is a different EpisodeFile to the current one, or this is the
- // first time through and we don't have an EpisodeFile yet
-
- // Save the current EpisodeFile
- var prev = _current;
-
- // Setup the new current EpisodeFile
- _current = episodeFile;
- _current.Episodes = new List();
- _current.Episodes.Add(episode);
- _current.Series = series;
-
- // Return the now populated previous EpisodeFile (or null if first time through)
- return prev;
- }
-
- }
-}
diff --git a/NzbDrone.Core/Datastore/SiaqodbProxy.cs b/NzbDrone.Core/Datastore/SiaqodbProxy.cs
deleted file mode 100644
index de5aadf1c..000000000
--- a/NzbDrone.Core/Datastore/SiaqodbProxy.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using Sqo;
-
-namespace NzbDrone.Core.Datastore
-{
- public interface IObjectDatabase : IDisposable
- {
- IEnumerable AsQueryable();
- T Insert(T obj) where T : ModelBase;
- T Update(T obj) where T : ModelBase;
- IList InsertMany(IList objects) where T : ModelBase;
- IList UpdateMany(IList objects) where T : ModelBase;
- void Delete(T obj) where T : ModelBase;
- void DeleteMany(IEnumerable objects) where T : ModelBase;
- void UpdateField(T model, string fieldName) where T : ModelBase;
- }
-
- public static class SiaqodbLogger
- {
- public static void ListenTo(Siaqodb db)
- {
- db.DeletedObject += OnDeletedObject;
- db.LoadingObject += OnLoadingObject;
- db.LoadedObject += OnLoadedObject;
- }
-
- private static void OnLoadedObject(object sender, LoadedObjectEventArgs e)
- {
- Write("Loaded", e.Object.GetType(), e.OID);
- }
-
- private static void OnLoadingObject(object sender, LoadingObjectEventArgs e)
- {
- Write("Loading", e.ObjectType, e.OID);
- }
-
- static void OnDeletedObject(object sender, DeletedEventsArgs e)
- {
- Write("Deleted", e.ObjectType, e.OID);
- }
-
- private static void Write(string operation, Type modelType, int id)
- {
- var message = string.Format("{0} {1}[{2}]", operation, modelType.Name, id);
- Trace.WriteLine(message, "Siaqodb");
- }
- }
-
- public class SiaqodbProxy : IObjectDatabase
- {
- private readonly Siaqodb _db;
-
- public SiaqodbProxy(Siaqodb db)
- {
- _db = db;
- //SiaqodbConfigurator.SetRaiseLoadEvents(true);
- //SiaqodbLogger.ListenTo(_db);
- }
-
-
- public void Dispose()
- {
-
- }
-
- public IEnumerable AsQueryable()
- {
- return _db.LoadAllLazy();
- }
-
- public T Insert(T obj) where T : ModelBase
- {
- if (obj.Id != 0)
- {
- throw new InvalidOperationException("Attempted to insert object with existing ID as new object");
- }
-
- _db.StoreObject(obj);
- return obj;
- }
-
- public T Update(T obj) where T : ModelBase
- {
- if (obj.Id == 0)
- {
- throw new InvalidOperationException("Attempted to update object without an ID");
- }
-
- _db.StoreObject(obj);
- return obj;
- }
-
- public IList InsertMany(IList objects) where T : ModelBase
- {
- return DoMany(objects, Insert);
- }
-
- public IList UpdateMany(IList objects) where T : ModelBase
- {
- return DoMany(objects, Update);
-
- }
-
- public void Delete(T obj) where T : ModelBase
- {
- _db.Delete(obj);
- }
-
- public void DeleteMany(IEnumerable objects) where T : ModelBase
- {
- foreach (var o in objects)
- {
- Delete(o);
- }
- }
-
- public void UpdateField(T model, string fieldName) where T : ModelBase
- {
- _db.StoreObjectPartially(model, fieldName);
-
- }
-
- private IList DoMany(IEnumerable objects, Func function) where T : ModelBase
- {
- return objects.Select(function).ToList();
- }
-
- }
-}
diff --git a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs b/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs
index 4a7e2f3e3..3811827bf 100644
--- a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs
+++ b/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs
@@ -38,7 +38,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
var matchingTitleWithQuality = matchigTitle.Where(q => q.ParseResult.Quality >= newParseResult.Quality);
- if (newParseResult.Series.SeriesTypes == SeriesTypes.Daily)
+ if (newParseResult.Series.SeriesType == SeriesTypes.Daily)
{
return matchingTitleWithQuality.Any(q => q.ParseResult.AirDate.Value.Date == newParseResult.AirDate.Value.Date);
}
diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs b/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs
index 6cc95c3f5..a3e4afcb6 100644
--- a/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs
+++ b/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs
@@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
var matchingTitleWithQuality = matchigTitle.Where(q => q.ParseResult.Quality >= newParseResult.Quality);
- if (newParseResult.Series.SeriesTypes == SeriesTypes.Daily)
+ if (newParseResult.Series.SeriesType == SeriesTypes.Daily)
{
return matchingTitleWithQuality.Any(q => q.ParseResult.AirDate.Value.Date == newParseResult.AirDate.Value.Date);
}
diff --git a/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs b/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs
index aab88548f..7b2f852dd 100644
--- a/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs
+++ b/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs
@@ -65,7 +65,7 @@ namespace NzbDrone.Core.ExternalNotification
new ExternalNotificationDefinition { Name = Name };
updateAction(def);
- _externalNotificationRepository.UpSert(def);
+ _externalNotificationRepository.Upsert(def);
}
private bool GetEnableStatus(Func readFunction)
diff --git a/NzbDrone.Core/ExternalNotification/ExternalNotificationRepository.cs b/NzbDrone.Core/ExternalNotification/ExternalNotificationRepository.cs
index e9bba4f92..667f28af9 100644
--- a/NzbDrone.Core/ExternalNotification/ExternalNotificationRepository.cs
+++ b/NzbDrone.Core/ExternalNotification/ExternalNotificationRepository.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Data;
using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.ExternalNotification
@@ -10,14 +10,14 @@ namespace NzbDrone.Core.ExternalNotification
public class ExternalNotificationRepository : BasicRepository, IExternalNotificationRepository
{
- public ExternalNotificationRepository(IObjectDatabase objectDatabase)
- : base(objectDatabase)
+ public ExternalNotificationRepository(IDbConnection database)
+ : base(database)
{
}
public ExternalNotificationDefinition Get(string name)
{
- return Queryable.SingleOrDefault(c => c.Name.ToLower() == name.ToLower());
+ return SingleOrDefault(c => c.Name.ToLower() == name.ToLower());
}
}
}
\ No newline at end of file
diff --git a/NzbDrone.Core/History/HistoryRepository.cs b/NzbDrone.Core/History/HistoryRepository.cs
index 04009a95e..e29da8cd4 100644
--- a/NzbDrone.Core/History/HistoryRepository.cs
+++ b/NzbDrone.Core/History/HistoryRepository.cs
@@ -1,4 +1,5 @@
using System;
+using System.Data;
using System.Linq;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv;
@@ -13,22 +14,22 @@ namespace NzbDrone.Core.History
public class HistoryRepository : BasicRepository, IHistoryRepository
{
- public HistoryRepository(IObjectDatabase objectDatabase)
- : base(objectDatabase)
+ public HistoryRepository(IDbConnection database)
+ : base(database)
{
}
public void Trim()
{
- var oldIds = Queryable.Where(c => c.Date < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
+ var oldIds = Where(c => c.Date < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds);
}
public QualityModel GetBestQualityInHistory(int seriesId, int seasonNumber, int episodeNumber)
{
- var history = Queryable.OrderByDescending(c => c.Quality).FirstOrDefault(c => c.Episode.Series.Id == seriesId && c.Episode.SeasonNumber == seasonNumber &&
- c.Episode.EpisodeNumber == episodeNumber);
+ var history = Where(c => c.Episode.Series.Id == seriesId && c.Episode.SeasonNumber == seasonNumber && c.Episode.EpisodeNumber == episodeNumber)
+ .OrderByDescending(c => c.Quality).FirstOrDefault();
if (history != null)
{
diff --git a/NzbDrone.Core/Indexers/IndexerRepository.cs b/NzbDrone.Core/Indexers/IndexerRepository.cs
index 405fa5f44..f06af337f 100644
--- a/NzbDrone.Core/Indexers/IndexerRepository.cs
+++ b/NzbDrone.Core/Indexers/IndexerRepository.cs
@@ -1,9 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Data;
using NzbDrone.Core.Datastore;
-using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Indexers
{
@@ -14,14 +11,14 @@ namespace NzbDrone.Core.Indexers
public class IndexerRepository : BasicRepository, IIndexerRepository
{
- public IndexerRepository(IObjectDatabase objectDatabase)
- : base(objectDatabase)
+ public IndexerRepository(IDbConnection database)
+ : base(database)
{
}
public Indexer Find(Type type)
{
- return Queryable.Single(i => i.Type == type.ToString());
+ return Single(i => i.Type == type.ToString());
}
}
}
diff --git a/NzbDrone.Core/Indexers/IndexerService.cs b/NzbDrone.Core/Indexers/IndexerService.cs
index 83a42dab4..3c0a1c352 100644
--- a/NzbDrone.Core/Indexers/IndexerService.cs
+++ b/NzbDrone.Core/Indexers/IndexerService.cs
@@ -67,7 +67,7 @@ namespace NzbDrone.Core.Indexers
{
//Todo: This will be used in the API
_logger.Debug("Upserting Indexer definitions for {0}", indexer.Name);
- _indexerRepository.UpSert(indexer);
+ _indexerRepository.Upsert(indexer);
}
public Indexer GetSettings(Type type)
diff --git a/NzbDrone.Core/Indexers/NewznabRepository.cs b/NzbDrone.Core/Indexers/NewznabRepository.cs
index 6e74b8777..9c4d67e2d 100644
--- a/NzbDrone.Core/Indexers/NewznabRepository.cs
+++ b/NzbDrone.Core/Indexers/NewznabRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Text;
using NzbDrone.Core.Datastore;
@@ -13,13 +14,13 @@ namespace NzbDrone.Core.Indexers
public class NewznabRepository : BasicRepository, INewznabRepository
{
- public NewznabRepository(IObjectDatabase objectDatabase) : base(objectDatabase)
+ public NewznabRepository(IDbConnection database) : base(database)
{
}
public IEnumerable Enabled()
{
- return Queryable.Where(n => n.Enabled);
+ return Where(n => n.Enabled);
}
}
}
diff --git a/NzbDrone.Core/Instrumentation/Log.cs b/NzbDrone.Core/Instrumentation/Log.cs
index 92a3b3432..3a6dd6bf7 100644
--- a/NzbDrone.Core/Instrumentation/Log.cs
+++ b/NzbDrone.Core/Instrumentation/Log.cs
@@ -1,12 +1,12 @@
using System;
using NzbDrone.Core.Datastore;
-using Sqo.Attributes;
+
namespace NzbDrone.Core.Instrumentation
{
public class Log : ModelBase
{
- [Text]
+
public string Message { get; set; }
public DateTime Time { get; set; }
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Instrumentation
public string Method { get; set; }
- [Text]
+
public string Exception { get; set; }
public string ExceptionType { get; set; }
diff --git a/NzbDrone.Core/Instrumentation/LogRepository.cs b/NzbDrone.Core/Instrumentation/LogRepository.cs
index dc22380c8..1d4d152c5 100644
--- a/NzbDrone.Core/Instrumentation/LogRepository.cs
+++ b/NzbDrone.Core/Instrumentation/LogRepository.cs
@@ -1,4 +1,5 @@
using System;
+using System.Data;
using System.Linq;
using NzbDrone.Core.Datastore;
@@ -11,14 +12,14 @@ namespace NzbDrone.Core.Instrumentation
public class LogRepository : BasicRepository, ILogRepository
{
- public LogRepository(IObjectDatabase objectDatabase)
- : base(objectDatabase)
+ public LogRepository(IDbConnection database)
+ : base(database)
{
}
public void Trim()
{
- var oldIds = Queryable.Where(c => c.Time < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
+ var oldIds = Where(c => c.Time < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds);
}
}
diff --git a/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs b/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs
index 0e30ce469..39d8af3ba 100644
--- a/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs
+++ b/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs
@@ -61,7 +61,7 @@ namespace NzbDrone.Core.Jobs.Implementations
return;
}
- if (episode.Series.SeriesTypes == SeriesTypes.Daily)
+ if (episode.Series.SeriesType == SeriesTypes.Daily)
{
if (!episode.AirDate.HasValue)
{
diff --git a/NzbDrone.Core/Jobs/JobRepository.cs b/NzbDrone.Core/Jobs/JobRepository.cs
index fd00e9617..52fc0be6e 100644
--- a/NzbDrone.Core/Jobs/JobRepository.cs
+++ b/NzbDrone.Core/Jobs/JobRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using NLog;
using NzbDrone.Core.Datastore;
@@ -18,8 +19,8 @@ namespace NzbDrone.Core.Jobs
private readonly IEnumerable _jobs;
private readonly Logger _logger;
- public JobRepository(IObjectDatabase objectDatabase, IEnumerable jobs, Logger logger)
- : base(objectDatabase)
+ public JobRepository(IDbConnection database, IEnumerable jobs, Logger logger)
+ : base(database)
{
_jobs = jobs;
_logger = logger;
@@ -27,13 +28,13 @@ namespace NzbDrone.Core.Jobs
public JobDefinition GetDefinition(Type type)
{
- return Queryable.Single(c => c.TypeName == type.FullName);
+ return Single(c => c.TypeName == type.FullName);
}
public IList GetPendingJobs()
{
- return Queryable.Where(c => c.Enable && c.LastExecution < DateTime.Now.AddMinutes(-c.Interval)).ToList();
+ return Where(c => c.Enable && c.LastExecution < DateTime.Now.AddMinutes(-c.Interval)).ToList();
}
public void Init()
@@ -68,7 +69,7 @@ namespace NzbDrone.Core.Jobs
jobDefinition.Interval = Convert.ToInt32(job.DefaultInterval.TotalMinutes);
- UpSert(jobDefinition);
+ Upsert(jobDefinition);
}
}
}
diff --git a/NzbDrone.Core/MediaFiles/MediaFileRepository.cs b/NzbDrone.Core/MediaFiles/MediaFileRepository.cs
index 4f309c6d7..8c15e243a 100644
--- a/NzbDrone.Core/MediaFiles/MediaFileRepository.cs
+++ b/NzbDrone.Core/MediaFiles/MediaFileRepository.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using NzbDrone.Core.Datastore;
@@ -14,25 +15,25 @@ namespace NzbDrone.Core.MediaFiles
public class MediaFileRepository : BasicRepository, IMediaFileRepository
{
- public MediaFileRepository(IObjectDatabase objectDatabase)
- : base(objectDatabase)
+ public MediaFileRepository(IDbConnection database)
+ : base(database)
{
}
public EpisodeFile GetFileByPath(string path)
{
- return Queryable.SingleOrDefault(c => c.Path == path);
+ return SingleOrDefault(c => c.Path == path);
}
public List GetFilesBySeries(int seriesId)
{
- return Queryable.Where(c => c.SeriesId == seriesId).ToList();
+ return Where(c => c.SeriesId == seriesId).ToList();
}
public List GetFilesBySeason(int seriesId, int seasonNumber)
{
- return Queryable.Where(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber).ToList();
+ return Where(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber).ToList();
}
}
diff --git a/NzbDrone.Core/Model/EpisodeParseResult.cs b/NzbDrone.Core/Model/EpisodeParseResult.cs
index 57cab5d40..7c7edd6a3 100644
--- a/NzbDrone.Core/Model/EpisodeParseResult.cs
+++ b/NzbDrone.Core/Model/EpisodeParseResult.cs
@@ -92,7 +92,7 @@ namespace NzbDrone.Core.Model
return seasonResult;
}
- if (Series.SeriesTypes == SeriesTypes.Daily)
+ if (Series.SeriesType == SeriesTypes.Daily)
{
var dailyResult = String.Format("{0} - {1:yyyy-MM-dd} - {2} [{3}]", seriesTitle,
AirDate, Episodes.First().Title, Quality.Quality);
diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj
index c4856cb50..d72d4dfa1 100644
--- a/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/NzbDrone.Core/NzbDrone.Core.csproj
@@ -140,6 +140,9 @@
..\packages\MediaInfoNet.0.3\lib\MediaInfoDotNet.dll
+
+ ..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\Mono.Data.Sqlite.dll
+ False..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll
@@ -161,17 +164,14 @@
..\packages\ServiceStack.Common.3.9.42\lib\net35\ServiceStack.Interfaces.dll
- ..\packages\ServiceStack.OrmLite.Sqlite32.3.9.42\lib\net40\ServiceStack.OrmLite.dll
+ ..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.dll
-
- ..\packages\ServiceStack.OrmLite.Sqlite32.3.9.42\lib\net40\ServiceStack.OrmLite.SqliteNET.dll
+
+ ..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.Sqlite.dll..\packages\ServiceStack.Text.3.9.42\lib\net35\ServiceStack.Text.dll
-
- ..\Libraries\Siaqodb\siaqodb.dll
- ..\packages\SignalR.Server.0.5.3\lib\net40\SignalR.dll
@@ -181,12 +181,6 @@
-
- ..\packages\System.Data.SQLite.1.0.84.0\lib\net40\System.Data.SQLite.dll
-
-
- ..\packages\System.Data.SQLite.1.0.84.0\lib\net40\System.Data.SQLite.Linq.dll
-
@@ -209,8 +203,6 @@
-
-
@@ -582,12 +574,9 @@
Always
-
- Always
-
-
- Always
-
+
+
+
diff --git a/NzbDrone.Core/Organizer/FileNameBuilder.cs b/NzbDrone.Core/Organizer/FileNameBuilder.cs
index 0f742fca0..427a16bd6 100644
--- a/NzbDrone.Core/Organizer/FileNameBuilder.cs
+++ b/NzbDrone.Core/Organizer/FileNameBuilder.cs
@@ -63,7 +63,7 @@ namespace NzbDrone.Core.Organizer
result += series.Title + nameSpec.Separator;
}
- if (series.SeriesTypes == SeriesTypes.Standard)
+ if (series.SeriesType == SeriesTypes.Standard)
{
result += numberStyle.Pattern.Replace("%0e",
String.Format("{0:00}", sortedEpisodes.First().EpisodeNumber));
diff --git a/NzbDrone.Core/Providers/DiskScanProvider.cs b/NzbDrone.Core/Providers/DiskScanProvider.cs
index 2304ea570..2db056e60 100644
--- a/NzbDrone.Core/Providers/DiskScanProvider.cs
+++ b/NzbDrone.Core/Providers/DiskScanProvider.cs
@@ -109,7 +109,7 @@ namespace NzbDrone.Core.Providers
var size = _diskProvider.GetSize(filePath);
var runTime = _mediaInfoProvider.GetRunTime(filePath);
- if (series.SeriesTypes == SeriesTypes.Daily || parseResult.SeasonNumber > 0)
+ if (series.SeriesType == SeriesTypes.Daily || parseResult.SeasonNumber > 0)
{
if (size < Constants.IgnoreFileSize && runTime < 180)
{
diff --git a/NzbDrone.Core/Providers/SearchProvider.cs b/NzbDrone.Core/Providers/SearchProvider.cs
index b92bde4b2..a232b96dc 100644
--- a/NzbDrone.Core/Providers/SearchProvider.cs
+++ b/NzbDrone.Core/Providers/SearchProvider.cs
@@ -36,7 +36,7 @@ namespace NzbDrone.Core.Providers
return new List();
}
- if (series.SeriesTypes == SeriesTypes.Daily)
+ if (series.SeriesType == SeriesTypes.Daily)
{
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
return new List();
@@ -65,7 +65,7 @@ namespace NzbDrone.Core.Providers
return new List();
}
- if (series.SeriesTypes == SeriesTypes.Daily)
+ if (series.SeriesType == SeriesTypes.Daily)
{
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
return new List();
diff --git a/NzbDrone.Core/Qualities/QualityProfileRepository.cs b/NzbDrone.Core/Qualities/QualityProfileRepository.cs
index 1de918e24..c57e2188a 100644
--- a/NzbDrone.Core/Qualities/QualityProfileRepository.cs
+++ b/NzbDrone.Core/Qualities/QualityProfileRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Text;
using NzbDrone.Core.Datastore;
@@ -13,7 +14,7 @@ namespace NzbDrone.Core.Qualities
public class QualityProfileRepository : BasicRepository, IQualityProfileRepository
{
- public QualityProfileRepository(IObjectDatabase database)
+ public QualityProfileRepository(IDbConnection database)
: base(database)
{
}
diff --git a/NzbDrone.Core/Qualities/QualitySizeRepository.cs b/NzbDrone.Core/Qualities/QualitySizeRepository.cs
index 8a91d6439..fe6f4bcb5 100644
--- a/NzbDrone.Core/Qualities/QualitySizeRepository.cs
+++ b/NzbDrone.Core/Qualities/QualitySizeRepository.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Data;
+using System.Linq;
using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Qualities
@@ -10,14 +11,14 @@ namespace NzbDrone.Core.Qualities
public class QualitySizeRepository : BasicRepository, IQualitySizeRepository
{
- public QualitySizeRepository(IObjectDatabase database)
+ public QualitySizeRepository(IDbConnection database)
: base(database)
{
}
public QualitySize GetByQualityId(int qualityId)
{
- return Queryable.Single(q => q.QualityId == qualityId);
+ return Single(q => q.QualityId == qualityId);
}
}
}
diff --git a/NzbDrone.Core/ReferenceData/SceneMappingRepository.cs b/NzbDrone.Core/ReferenceData/SceneMappingRepository.cs
index 18984efbd..b05b12741 100644
--- a/NzbDrone.Core/ReferenceData/SceneMappingRepository.cs
+++ b/NzbDrone.Core/ReferenceData/SceneMappingRepository.cs
@@ -1,3 +1,4 @@
+using System.Data;
using System.Linq;
using NzbDrone.Core.Datastore;
@@ -12,19 +13,19 @@ namespace NzbDrone.Core.ReferenceData
public class SceneMappingRepository : BasicRepository, ISceneMappingRepository
{
- public SceneMappingRepository(IObjectDatabase objectDatabase)
- : base(objectDatabase)
+ public SceneMappingRepository(IDbConnection database)
+ : base(database)
{
}
public SceneMapping FindByTvdbId(int tvdbId)
{
- return Queryable.SingleOrDefault(c => c.TvdbId == tvdbId);
+ return SingleOrDefault(c => c.TvdbId == tvdbId);
}
public SceneMapping FindByCleanTitle(string cleanTitle)
{
- return Queryable.SingleOrDefault(c => c.CleanTitle == cleanTitle);
+ return SingleOrDefault(c => c.CleanTitle == cleanTitle);
}
}
}
\ No newline at end of file
diff --git a/NzbDrone.Core/RootFolders/RootFolder.cs b/NzbDrone.Core/RootFolders/RootFolder.cs
index 86288c371..d78d29fa4 100644
--- a/NzbDrone.Core/RootFolders/RootFolder.cs
+++ b/NzbDrone.Core/RootFolders/RootFolder.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using NzbDrone.Core.Datastore;
-using Sqo.Attributes;
+
namespace NzbDrone.Core.RootFolders
{
@@ -8,7 +8,6 @@ namespace NzbDrone.Core.RootFolders
{
public string Path { get; set; }
- [Ignore]
public ulong FreeSpace { get; set; }
public List UnmappedFolders { get; set; }
diff --git a/NzbDrone.Core/Tv/Episode.cs b/NzbDrone.Core/Tv/Episode.cs
index 57fb67350..7f4ccfef9 100644
--- a/NzbDrone.Core/Tv/Episode.cs
+++ b/NzbDrone.Core/Tv/Episode.cs
@@ -2,7 +2,7 @@
using NzbDrone.Core.Datastore;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Model;
-using Sqo.Attributes;
+
namespace NzbDrone.Core.Tv
{
@@ -18,7 +18,7 @@ namespace NzbDrone.Core.Tv
//Todo: Since we're displaying next airing relative to the user's time zone we may want to store this as UTC (with airtime + UTC offset)
public DateTime? AirDate { get; set; }
- [Text]
+
public string Overview { get; set; }
public Boolean Ignored { get; set; }
@@ -85,7 +85,7 @@ namespace NzbDrone.Core.Tv
{
string seriesTitle = Series == null ? "[NULL]" : Series.Title;
- if (Series != null && Series.SeriesTypes == SeriesTypes.Daily && AirDate.HasValue)
+ if (Series != null && Series.SeriesType == SeriesTypes.Daily && AirDate.HasValue)
return string.Format("{0} - {1:yyyy-MM-dd}", seriesTitle, AirDate.Value);
return string.Format("{0} - S{1:00}E{2:00}", seriesTitle, SeasonNumber, EpisodeNumber);
diff --git a/NzbDrone.Core/Tv/EpisodeRepository.cs b/NzbDrone.Core/Tv/EpisodeRepository.cs
index 9b04325b3..c282abf40 100644
Binary files a/NzbDrone.Core/Tv/EpisodeRepository.cs and b/NzbDrone.Core/Tv/EpisodeRepository.cs differ
diff --git a/NzbDrone.Core/Tv/EpisodeService.cs b/NzbDrone.Core/Tv/EpisodeService.cs
index 50de26d04..dd27452e3 100644
--- a/NzbDrone.Core/Tv/EpisodeService.cs
+++ b/NzbDrone.Core/Tv/EpisodeService.cs
@@ -99,7 +99,7 @@ namespace NzbDrone.Core.Tv
if (parseResult.AirDate.HasValue)
{
- if (parseResult.Series.SeriesTypes == SeriesTypes.Standard)
+ if (parseResult.Series.SeriesType == SeriesTypes.Standard)
{
//Todo: Collect this as a Series we want to treat as a daily series, or possible parsing error
logger.Warn("Found daily-style episode for non-daily series: {0}. {1}", parseResult.Series.Title, parseResult.OriginalString);
diff --git a/NzbDrone.Core/Tv/SeasonRepository.cs b/NzbDrone.Core/Tv/SeasonRepository.cs
index 2d5eba1de..43d183194 100644
--- a/NzbDrone.Core/Tv/SeasonRepository.cs
+++ b/NzbDrone.Core/Tv/SeasonRepository.cs
@@ -6,7 +6,7 @@ using ServiceStack.OrmLite;
namespace NzbDrone.Core.Tv
{
- public interface ISeasonRepository : IBasicDb
+ public interface ISeasonRepository : IBasicRepository
{
IList GetSeasonNumbers(int seriesId);
Season Get(int seriesId, int seasonNumber);
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Tv
List GetSeasonBySeries(int seriesId);
}
- public class SeasonRepository : BasicDb, ISeasonRepository
+ public class SeasonRepository : BasicRepository, ISeasonRepository
{
private readonly IDbConnection _database;
diff --git a/NzbDrone.Core/Tv/Series.cs b/NzbDrone.Core/Tv/Series.cs
index 625eda2ea..a29df6b5c 100644
--- a/NzbDrone.Core/Tv/Series.cs
+++ b/NzbDrone.Core/Tv/Series.cs
@@ -5,7 +5,7 @@ using NzbDrone.Core.Datastore;
using NzbDrone.Core.Model;
using NzbDrone.Core.Qualities;
-using Sqo.Attributes;
+
namespace NzbDrone.Core.Tv
{
@@ -23,7 +23,7 @@ namespace NzbDrone.Core.Tv
public string CleanTitle { get; set; }
public string Status { get; set; }
- [Text]
+
public string Overview { get; set; }
public String AirTime { get; set; }
diff --git a/NzbDrone.Core/Tv/SeriesRepository.cs b/NzbDrone.Core/Tv/SeriesRepository.cs
index 5ca1e4c17..e66f032f4 100644
--- a/NzbDrone.Core/Tv/SeriesRepository.cs
+++ b/NzbDrone.Core/Tv/SeriesRepository.cs
@@ -6,7 +6,7 @@ using ServiceStack.OrmLite;
namespace NzbDrone.Core.Tv
{
- public interface ISeriesRepository : IBasicDb
+ public interface ISeriesRepository : IBasicRepository
{
bool SeriesPathExists(string path);
List Search(string title);
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Tv
void SetSeriesType(int seriesId, SeriesTypes seriesTypes);
}
- public class SeriesRepository : BasicDb, ISeriesRepository
+ public class SeriesRepository : BasicRepository, ISeriesRepository
{
public SeriesRepository(IDbConnection database)
: base(database)
diff --git a/NzbDrone.Core/packages.config b/NzbDrone.Core/packages.config
index 9d367ca15..14799a275 100644
--- a/NzbDrone.Core/packages.config
+++ b/NzbDrone.Core/packages.config
@@ -10,10 +10,9 @@
-
+
-
\ No newline at end of file
diff --git a/NzbDrone.Core/sqlite/x86/sqlite3.dll b/NzbDrone.Core/sqlite/x86/sqlite3.dll
new file mode 100644
index 000000000..45b2e4eb3
Binary files /dev/null and b/NzbDrone.Core/sqlite/x86/sqlite3.dll differ
diff --git a/NzbDrone.Core/sqlite/x86/sqlite3.exe b/NzbDrone.Core/sqlite/x86/sqlite3.exe
new file mode 100644
index 000000000..cd3329063
Binary files /dev/null and b/NzbDrone.Core/sqlite/x86/sqlite3.exe differ
diff --git a/NzbDrone.Core/x86/SQLite.Interop.dll b/NzbDrone.Core/x86/SQLite.Interop.dll
deleted file mode 100644
index 1838fba8d..000000000
Binary files a/NzbDrone.Core/x86/SQLite.Interop.dll and /dev/null differ
diff --git a/NzbDrone/NzbDrone.csproj b/NzbDrone/NzbDrone.csproj
index 97087c0d7..a5f349634 100644
--- a/NzbDrone/NzbDrone.csproj
+++ b/NzbDrone/NzbDrone.csproj
@@ -87,10 +87,6 @@
..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll
-
- False
- ..\Libraries\Siaqodb\siaqodb.dll
-
@@ -102,7 +98,6 @@
Component
-
diff --git a/NzbDrone/licenses.licx b/NzbDrone/licenses.licx
deleted file mode 100644
index 4b128908d..000000000
--- a/NzbDrone/licenses.licx
+++ /dev/null
@@ -1 +0,0 @@
-Sqo.Siaqodb, siaqodb, Version=2.6.0.2,Culture=neutral,PublicKeyToken=c9a50dde883b61a3
\ No newline at end of file