removed sqo.

pull/2/head
kay.one 12 years ago
parent 7717e32729
commit 1a4f3fad25

@ -1,636 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>siaqodb</name>
</assembly>
<members>
<member name="T:Sqo.Attributes.IgnoreAttribute">
<summary>
Attribute to be used for a member of a storable class and that object will be ignored by siaqodb engine
</summary>
</member>
<member name="T:Sqo.Attributes.MaxLengthAttribute">
<summary>
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
</summary>
</member>
<member name="M:Sqo.Attributes.MaxLengthAttribute.#ctor(System.Int32)">
<summary>
Create an attribute instance of Type MaxLength
</summary>
<param name="maxLength">number of characters from string to be stored in database</param>
</member>
<member name="T:Sqo.Attributes.UseVariableAttribute">
<summary>
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
</summary>
</member>
<member name="T:Sqo.Internal._bs">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="M:Sqo.Internal._bs._b(System.String)">
<summary>
Do NOT use it!, it is used only internally
</summary>
<param name="p">
</param>
<returns>
</returns>
</member>
<member name="M:Sqo.Internal._bs._ofm(System.String,System.String)">
<summary>
Do NOT use it!, it is used only internally
</summary>
<param name="p">
</param>
<returns>
</returns>
</member>
<member name="M:Sqo.Internal._bs._uf(Sqo.Siaqodb,System.Int32,Sqo.MetaType,System.String,System.Object)">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="M:Sqo.Internal._bs._gd(Sqo.Siaqodb,System.Type)">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="M:Sqo.Internal._bs._do(Sqo.Siaqodb,System.Int32,Sqo.MetaType)">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="M:Sqo.Internal._bs._io(Sqo.Siaqodb,Sqo.MetaType)">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="M:Sqo.Internal._bs._sdbfn(Sqo.Siaqodb,Sqo.MetaType,System.String)">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="M:Sqo.Internal._bs._loidtid(Sqo.Siaqodb,System.Int32,Sqo.MetaType,System.String,System.Collections.Generic.List{System.Int32}@,System.Int32@)">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="M:Sqo.Internal._bs._ltid(Sqo.Siaqodb,System.Int32,Sqo.MetaType,System.String,System.Int32@,System.Boolean@)">
<summary>
Do NOT use it!, it is used only internally
</summary>
</member>
<member name="T:Sqo.SiaqodbConfigurator">
<summary>
Class responsible for configurations of Siaqodb database engine
</summary>
</member>
<member name="M:Sqo.SiaqodbConfigurator.AddIndex(System.String,System.Type)">
<summary>
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
</summary>
<param name="field">Field name or automatic property name</param>
<param name="type">Type that declare the field</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.AddUniqueConstraint(System.String,System.Type)">
<summary>
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
</summary>
<param name="field">Field name or automatic property name</param>
<param name="type">Type that declare the field</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.AddMaxLength(System.String,System.Int32,System.Type)">
<summary>
Put MaxLength for a string field or automatic property of a Type, MaxLength can be set also by using Attribute: Sqo.Attributes.MaxLength
</summary>
<param name="field">Field name or automatic property name</param>
<param name="maxLength">max length for a string</param>
<param name="type">Type that declare the field</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.AddIgnore(System.String,System.Type)">
<summary>
Ignore a field or automatic property to be stored
</summary>
<param name="field">Name of field or automatic property</param>
<param name="type">Type that declare the field</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.PropertyUseField(System.String,System.String,System.Type)">
<summary>
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
</summary>
<param name="propertyName">Name of property</param>
<param name="fieldName">Name of backing field of property</param>
<param name="type">
</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.SetEncryptionPassword(System.String)">
<summary>
Set the password for encryption algorithm used to encrypt database data
</summary>
<param name="pwd">The password</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.SetEncryptor(Sqo.Encryption.IEncryptor)">
<summary>
Set your custom encryption algorithm that implemets IEncryptor interface
</summary>
<param name="encryptor">The instance of custom encryption algorithm</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.SetEncryptor(Sqo.BuildInAlgorithm)">
<summary>
Set build-in encryption algorithm
</summary>
<param name="alg">Encryption algorithm</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.SetDatabaseFileName``1(System.String)">
<summary>
Set custom fileName on disk of database file for Type T
</summary>
<typeparam name="T">Type of objects</typeparam>
<param name="fileName">Name of database file on disk</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.LoadRelatedObjects``1(System.Boolean)">
<summary>
By default this is true for all types. Set this to false to not load childs entities of objects of Type provided
</summary>
<typeparam name="T">Type for objects</typeparam>
<param name="loadRelatedObjects">true if related object need to be loaded, false if you want to load by Include(...) method</param>
</member>
<member name="M:Sqo.SiaqodbConfigurator.SetRaiseLoadEvents(System.Boolean)">
<summary>
Set true to raise Loading/Loaded events
</summary>
<param name="raiseLoadEvents">
</param>
</member>
<member name="P:Sqo.SiaqodbConfigurator.EncryptedDatabase">
<summary>
Set if database will be encrypted or not
</summary>
</member>
<member name="T:Sqo.SiaqodbUtil">
<summary>
Database utilities
</summary>
</member>
<member name="M:Sqo.SiaqodbUtil.ReIndex(System.String)">
<summary>
Rebuild and defragment indexes
</summary>
<param name="siaqodb">
</param>
</member>
<member name="M:Sqo.SiaqodbUtil.Shrink(System.String,Sqo.ShrinkType)">
<summary>
Shrink database files including rawdata.sqr and indexes
</summary>
</member>
<member name="M:Sqo.SiaqodbUtil.Repair(System.String)">
<summary>
Repair database files by fixing corrupted objects bytes
</summary>
<param name="siaqodb">
</param>
</member>
<member name="M:Sqo.SiaqodbUtil.RepairType``1(System.String)">
<summary>
Repair database file of Type provided, the corrupted objects will be recuperated or deleted
</summary>
<param name="siaqodb">
</param>
</member>
<member name="F:Sqo.ShrinkType.Normal">
<summary>
Normal shrink, all blocks marked as free will be supressed
</summary>
</member>
<member name="F:Sqo.ShrinkType.ForceClaimSpace">
<summary>
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.
</summary>
</member>
<member name="F:Sqo.ShrinkType.Total">
<summary>
This includes Normal + ForceClaimSpace but also shrink of every db file; after this operation OID values of the stored objects may change.
</summary>
</member>
<member name="T:Sqo.SqoDataObject">
<summary>
Basic class that any siaqodb storable class may inherits from
</summary>
</member>
<member name="P:Sqo.SqoDataObject.OID">
<summary>
Object Identifier(unique per Type)
</summary>
</member>
<member name="T:Sqo.IObjectList`1">
<summary>
Main interface to be used by implementers to retrieve objects from database
</summary>
<typeparam name="T">
</typeparam>
</member>
<!-- Badly formed XML comment ignored for member "M:Sqo.Evaluator.PartialEval(System.Linq.Expressions.Expression,System.Func{System.Linq.Expressions.Expression,System.Boolean})" -->
<!-- Badly formed XML comment ignored for member "T:Sqo.Evaluator.SubtreeEvaluator" -->
<!-- Badly formed XML comment ignored for member "T:Sqo.Evaluator.Nominator" -->
<member name="T:Sqo.MetaField">
<summary>
Class that describe a field of an object stored in database
</summary>
</member>
<member name="P:Sqo.MetaField.Name">
<summary>
Name of field stored in database
</summary>
</member>
<member name="P:Sqo.MetaField.FieldType">
<summary>
Type of field stored in database
</summary>
</member>
<member name="T:Sqo.MetaType">
<summary>
Class that describe Type of objects stored in database
</summary>
</member>
<member name="P:Sqo.MetaType.Name">
<summary>
Name of Type stored in database
</summary>
</member>
<member name="P:Sqo.MetaType.Fields">
<summary>
List of fields
</summary>
</member>
<member name="T:Sqo.Siaqodb">
<summary>
Main class of siaqodb database engine responsible for storing, retrieving ,deleting objects on database files
</summary>
</member>
<member name="M:Sqo.Siaqodb.#ctor">
<summary>
Create a new instance of Siaqodb, database is not opened yet
</summary>
</member>
<member name="M:Sqo.Siaqodb.#ctor(System.String)">
<summary>
Create a new instance of Siaqodb and open the database
</summary>
<param name="path">Physical folder name where objects are stored</param>
</member>
<member name="M:Sqo.Siaqodb.Open(System.String)">
<summary>
Open database folder
</summary>
<param name="path">path where objects are stored</param>
</member>
<member name="M:Sqo.Siaqodb.StoreObject(System.Object)">
<summary>
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
</summary>
<param name="obj">Object to be stored</param>
</member>
<member name="M:Sqo.Siaqodb.StoreObjectPartially(System.Object,System.String[])">
<summary>
Insert or update object partially, only provided properties are saved
</summary>
<param name="obj">object of which properties will be stored</param>
<param name="properties">properties to be stored</param>
</member>
<member name="M:Sqo.Siaqodb.StoreObjectPartially(System.Object,System.Boolean,System.String[])">
<summary>
Insert or update object partially, only provided properties are saved
</summary>
<param name="obj">object of which properties will be stored</param>
<param name="properties">properties to be stored</param>
<param name="onlyReferences">if true,it will store only references to complex objects</param>
</member>
<member name="M:Sqo.Siaqodb.StoreObject(System.Object,Sqo.Transactions.Transaction)">
<summary>
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
</summary>
<param name="obj">Object to be stored</param>
<param name="transaction">Transaction object</param>
</member>
<member name="M:Sqo.Siaqodb.LoadAll``1">
<summary>
Load all objects of Type provided
</summary>
<typeparam name="T">Type of objects to be loaded from database</typeparam>
<returns>List of objects retrieved from database</returns>
</member>
<member name="M:Sqo.Siaqodb.LoadObjectByOID``1(System.Int32)">
<summary>
Load object from database by OID provided
</summary>
<typeparam name="T">The Type of object to be loaded</typeparam>
<param name="oid">oid of object</param>
<returns>the object stored in database with oid provided</returns>
</member>
<member name="M:Sqo.Siaqodb.Close">
<summary>
Close database
</summary>
</member>
<member name="M:Sqo.Siaqodb.Cast``1">
<summary>
Cast method to be used in LINQ queries
</summary>
<typeparam name="T">Type over which LINQ will take action</typeparam>
<returns>
</returns>
</member>
<member name="M:Sqo.Siaqodb.Query``1">
<summary>
Query method to be used in LINQ queries
</summary>
<typeparam name="T">Type over which LINQ will take action</typeparam>
<returns>
</returns>
</member>
<member name="M:Sqo.Siaqodb.LoadOids``1(System.Linq.Expressions.Expression)">
<summary>
Load OIDs by expression
</summary>
<typeparam name="T">Type for which OIDs will be loaded</typeparam>
<param name="expression">filter expression</param>
<returns>List of OIDs</returns>
</member>
<member name="M:Sqo.Siaqodb.LoadAllOIDs(Sqo.MetaType)">
<summary>
Load all object OIDs of MetaType provided
</summary>
<param name="type">meta type Load by method GetAllTypes()</param>
<returns>
</returns>
</member>
<member name="M:Sqo.Siaqodb.LoadValue(System.Int32,System.String,Sqo.MetaType)">
<summary>
Load value of a field of an object identified by OID provided
</summary>
<param name="oid">OID of object</param>
<param name="fieldName">fieldName</param>
<param name="mt">MetaType</param>
<returns>
</returns>
</member>
<member name="M:Sqo.Siaqodb.Delete(System.Object)">
<summary>
Delete an object from database
</summary>
<param name="obj">Object to be deleted</param>
</member>
<member name="M:Sqo.Siaqodb.Delete(System.Object,Sqo.Transactions.Transaction)">
<summary>
Delete an object from database using a Transaction
</summary>
<param name="obj">Object to be deleted</param>
<param name="transaction">Transaction</param>
</member>
<member name="M:Sqo.Siaqodb.DeleteObjectBy(System.String,System.Object)">
<summary>
Delete an object from database by a certain field(ex:ID that come from server)
</summary>
<param name="obj">Object to be deleted</param>
<param name="fieldName">Names of field that this method will lookup for object to delete it</param>
</member>
<member name="M:Sqo.Siaqodb.DeleteObjectBy(System.Object,System.String[])">
<summary>
Delete an object from database by a certain field(ex:ID that come from server)
</summary>
<param name="obj">Object to be deleted</param>
<param name="fieldNames">Names of fields that this method will lookup for object to delete it</param>
</member>
<member name="M:Sqo.Siaqodb.DeleteObjectBy(System.Object,Sqo.Transactions.Transaction,System.String[])">
<summary>
Delete an object from database by a certain field(ex:ID that come from server)
</summary>
<param name="obj">Object to be deleted</param>
<param name="fieldNames">Names of fields that this method will lookup for object to delete it</param>
<param name="transaction">Transaction object</param>
</member>
<member name="M:Sqo.Siaqodb.DeleteObjectBy``1(System.Collections.Generic.Dictionary{System.String,System.Object})">
<summary>
Delete an object from database by a criteria
</summary>
<param name="criteria">Pairs of fields-values to lookup for object to delete it</param>
<returns>Number of objects deleted</returns>
</member>
<member name="M:Sqo.Siaqodb.DropType``1">
<summary>
Delete all objects of Type provided
</summary>
<typeparam name="T">Type of objects to be deleted</typeparam>
</member>
<member name="M:Sqo.Siaqodb.DropType(System.Type)">
<summary>
Delete all objects of Type provided
</summary>
<param name="type">Type of objects to be deleted</param>&gt;
</member>
<member name="M:Sqo.Siaqodb.DropType(System.Type,System.Boolean)">
<summary>
Delete all objects of Type provided
</summary>
<param name="type">Type of objects to be deleted</param>
<param name="claimFreespace">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</param>
</member>
<member name="M:Sqo.Siaqodb.GetAllTypes">
<summary>
Return all Types from database folder
</summary>
<returns>List of MetaType objects</returns>
</member>
<member name="M:Sqo.Siaqodb.Count``1">
<summary>
Return number of objects of Type provided
</summary>
<typeparam name="T">Type of objects</typeparam>
<returns>
</returns>
</member>
<member name="M:Sqo.Siaqodb.ExportToXML``1(System.Xml.XmlWriter)">
<summary>
Export to XML all objects of Type provided from database
</summary>
<typeparam name="T">Type of objects to be exported</typeparam>
<param name="writer">XmlWriter</param>
</member>
<member name="M:Sqo.Siaqodb.ExportToXML``1(System.Xml.XmlWriter,System.Collections.Generic.IList{``0})">
<summary>
Export to XML list of objects provided
</summary>
<typeparam name="T">Type of objects</typeparam>
<param name="writer">XmlWriter</param>
<param name="objects">list of objects to be exported</param>
</member>
<member name="M:Sqo.Siaqodb.ImportFromXML``1(System.Xml.XmlReader)">
<summary>
Import from XML objects and return a list of them
</summary>
<typeparam name="T">Type of objects to be imported</typeparam>
<param name="reader">XmlReader</param>
<returns>List of objects imported</returns>
</member>
<member name="M:Sqo.Siaqodb.ImportFromXML``1(System.Xml.XmlReader,System.Boolean)">
<summary>
Import from XML objects and return a list and save into database
</summary>
<typeparam name="T">Type of objects to be imported</typeparam>
<param name="reader">XmlReader</param>
<param name="importIntoDB">if TRUE objects are saved also in database</param>
<returns>List of objects imported</returns>
</member>
<member name="M:Sqo.Siaqodb.SetDatabaseFileName``1(System.String)">
<summary>
this method is obsolete Use SiaqodbConfigurator.SetDatabaseFileName() method
</summary>
<typeparam name="T">type</typeparam>
<param name="fileName">fielName</param>
</member>
<member name="M:Sqo.Siaqodb.UpdateObjectBy(System.String,System.Object)">
<summary>
Update an object in database by a certain Field(eq: ID that come from a server)
</summary>
<param name="fieldName">FieldName by which update is made(eq an ID)</param>
<param name="obj">object that has all values but not OID to update it in database</param>
<returns>true if object was updated and false if object was not found in database</returns>
</member>
<member name="M:Sqo.Siaqodb.UpdateObjectBy(System.Object,System.String[])">
<summary>
Update an object in database by certain Fields(eq: ID that come from a server)
</summary>
<param name="fieldNames">name of fields by which update is made(eq an ID)</param>
<param name="obj">object that has all values but not OID to update it in database</param>
<returns>true if object was updated and false if object was not found in database</returns>
</member>
<member name="M:Sqo.Siaqodb.UpdateObjectBy(System.Object,Sqo.Transactions.Transaction,System.String[])">
<summary>
Update an object in database by certain Fields(eq: ID that come from a server)
</summary>
<param name="fieldNames">name of fields by which update is made(eq an ID)</param>
<param name="obj">object that has all values but not OID to update it in database</param>
<param name="transaction">Transaction object</param>
<returns>true if object was updated and false if object was not found in database</returns>
</member>
<member name="M:Sqo.Siaqodb.GetDBPath">
<summary>
return current database path
</summary>
<returns>The database folder path</returns>
</member>
<member name="M:Sqo.Siaqodb.BeginTransaction">
<summary>
Start a database Transaction to be used on insert/update/delete objects
</summary>
<returns> Transaction object</returns>
</member>
<member name="M:Sqo.Siaqodb.LoadIndexValues``2(System.String)">
<summary>
Get a list of unique values for a field index
</summary>
<typeparam name="T">Type where index is defined</typeparam>
<typeparam name="TIndex">Type of field indexed</typeparam>
<param name="fieldName">Name of field or automatic property which is indexed</param>
<returns>
</returns>
</member>
<member name="M:Sqo.Siaqodb.LoadAllLazy``1">
<summary>
Load all objects in Lazy mode, objects are activated/read from db when it is accessed
by index or by enumerator
</summary>
<typeparam name="T">Type of objects to be loaded from database</typeparam>
<returns>LazyObjectList of objects</returns>
</member>
<member name="M:Sqo.Siaqodb.GetOID(System.Object)">
<summary>
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
</summary>
<param name="obj">The object for which OID is returned</param>
<returns>The OID associated with object that is stored in database</returns>
</member>
<member name="E:Sqo.Siaqodb.SavingObject">
<summary>
Raised before an object is saved in database
</summary>
</member>
<member name="E:Sqo.Siaqodb.SavedObject">
<summary>
Raised after an object is saved in database
</summary>
</member>
<member name="E:Sqo.Siaqodb.DeletingObject">
<summary>
Raised before an object is deleted from database
</summary>
</member>
<member name="E:Sqo.Siaqodb.DeletedObject">
<summary>
Raised after an object is deleted from database
</summary>
</member>
<member name="E:Sqo.Siaqodb.LoadingObject">
<summary>
Raised before an object is loaded from database
</summary>
</member>
<member name="E:Sqo.Siaqodb.LoadedObject">
<summary>
Raised after object is loaded from database
</summary>
</member>
<member name="T:Sqo.ObjectList`1">
<summary>
List used to retrieve objects from database
</summary>
<typeparam name="T">Type of objects from list</typeparam>
</member>
<member name="M:Sqo.ObjectList`1.Add(`0)">
<summary>
Add obeject of Type T in the list
</summary>
<param name="item">object to be added</param>
</member>
<member name="M:Sqo.ObjectList`1.Clear">
<summary>
Remove all elements from list
</summary>
</member>
<member name="M:Sqo.ObjectList`1.Contains(`0)">
<summary>
Determines if an element is in list
</summary>
<param name="item">The object to locate in list</param>
<returns>bool value if object was found or not</returns>
</member>
<member name="M:Sqo.ObjectList`1.Remove(`0)">
<summary>
Remove object from list
</summary>
<param name="item">The object to remove</param>
<returns>bool value if object was removed or not</returns>
</member>
<member name="M:Sqo.Transactions.Transaction.Commit">
<summary>
Commit transaction to database
</summary>
</member>
<member name="M:Sqo.Transactions.Transaction.Rollback">
<summary>
Rollback changes
</summary>
</member>
</members>
</doc>

Binary file not shown.

@ -65,10 +65,6 @@
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="siaqodb, Version=3.6.0.0, Culture=neutral, PublicKeyToken=c9a50dde883b61a3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\Siaqodb\siaqodb.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
@ -122,11 +118,6 @@
<Link>NzbDrone.ico</Link>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\NzbDrone\licenses.licx">
<Link>licenses.licx</Link>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>

@ -9,7 +9,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.Configuration
{
[TestFixture]
public class ConfigServiceFixture : ObjectDbTest<ConfigService, Config>
public class ConfigServiceFixture : DbTest<ConfigService, Config>
{
[SetUp]
public void SetUp()

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.Datastore
}
[TestFixture]
public class BasicRepositoryFixture : ObjectDbTest<BasicRepository<BaiscType>,BaiscType>
public class BasicRepositoryFixture : DbTest<BasicRepository<BaiscType>,BaiscType>
{
private BaiscType _baiscType;

@ -10,245 +10,119 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Datastore
{
[TestFixture]
public class ObjectDatabaseFixture : ObjectDbTest
public class ObjectDatabaseFixture : DbTest<BasicRepository<BaiscType>, BaiscType>
{
private ChildModel _childModel;
private ParentModel _parentModel;
private BaiscType _sampleType;
[SetUp]
public void SetUp()
{
_childModel = Builder<ChildModel>
_sampleType = Builder<BaiscType>
.CreateNew()
.With(s => s.Id = 0)
.Build();
_parentModel = Builder<ParentModel>
.CreateNew()
.With(e => e.Id = 0)
.Build();
}
[Test]
public void should_be_able_to_write_to_database()
{
Db.Insert(_childModel);
Db.AsQueryable<ChildModel>().Should().HaveCount(1);
Subject.Insert(_sampleType);
Db.All<BaiscType>().Should().HaveCount(1);
}
[Test]
public void double_insert_should_fail()
{
Db.Insert(_childModel);
Assert.Throws<InvalidOperationException>(() => Db.Insert(_childModel));
Subject.Insert(_sampleType);
Assert.Throws<InvalidOperationException>(() => Subject.Insert(_sampleType));
}
[Test]
public void update_item_with_root_index_0_should_faile()
{
_childModel.Id = 0;
Assert.Throws<InvalidOperationException>(() => Db.Update(_childModel));
_sampleType.Id = 0;
Assert.Throws<InvalidOperationException>(() => Subject.Update(_sampleType));
}
[Test]
public void should_be_able_to_store_empty_list()
{
var series = new List<ParentModel>();
Db.InsertMany(series);
}
[Test]
public void should_not_store_dirty_data_in_cache()
{
Db.Insert(_parentModel);
Db.AsQueryable<ParentModel>().Single().Child.Should().BeNull();
_parentModel.Child = Builder<ChildModel>.CreateNew().Build();
Db.AsQueryable<ParentModel>().Single().Child.Should().BeNull();
}
[Test]
public void should_store_nested_objects()
{
_parentModel.Child = _childModel;
Db.Insert(_parentModel);
Db.AsQueryable<ParentModel>().Should().HaveCount(1);
Db.AsQueryable<ParentModel>().Single().Child.Should().NotBeNull();
}
[Test]
public void should_update_nested_objects()
{
_parentModel.Child = Builder<ChildModel>
.CreateNew()
.With(s => s.Id = 0)
.Build();
Db.Insert(_parentModel);
var series = new List<BaiscType>();
_parentModel.Child.A = "UpdatedTitle";
Db.Update(_parentModel);
Db.AsQueryable<ParentModel>().Should().HaveCount(1);
Db.AsQueryable<ParentModel>().Single().Child.Should().NotBeNull();
Db.AsQueryable<ParentModel>().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<ChildModel>().Should().HaveCount(1);
_childModel.Id.Should().Be(1);
Db.All<BaiscType>().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<ChildModel>();
_sampleType.Id = 0;
Subject.Insert(_sampleType);
var item = Db.All<BaiscType>();
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<ChildModel>().Single(c => c.Id == _childModel.Id);
Subject.Insert(_sampleType);
var item = Db.All<BaiscType>().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<ParentModel>().Single().Child.Should().NotBeNull();
Db.Delete(_childModel);
Db.AsQueryable<ParentModel>().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<ChildModel>.CreateListOfSize(5)
.All()
.With(c => c.Id = 0)
.Build();
_parentModel.ChildList = children.ToList();
Db.Insert(_parentModel);
Db.AsQueryable<ParentModel>().Single().ChildList.Should().HaveSameCount(children);
Db.Delete(children[1]);
Db.AsQueryable<ParentModel>().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<ChildModel>().Single().A.Should().Be("A_Original");
Db.AsQueryable<ChildModel>().Single().B.Should().Be(2);
Db.AsQueryable<ChildModel>().Single().C.Should().Be(1);
Db.All<BaiscType>().Single().Address.Should().Be("Address");
Db.All<BaiscType>().Single().Name.Should().Be("B");
Db.All<BaiscType>().Single().Tilte.Should().Be("Title");
}
[Test]
public void should_be_able_to_read_unknown_type()
{
Db.AsQueryable<UnknownType>().ToList().Should().BeEmpty();
}
}
public class UnknownType : ModelBase
{
public string Field1 { get; set; }
}
public class NestedModel : ModelBase
{
public NestedModel()
{
List = new List<NestedModel> { this };
}
public List<NestedModel> List { get; set; }
}
public class ParentModel : ModelBase
{
public ChildModel Child { get; set; }
public List<ChildModel> ChildList { get; set; }
}
public class ChildModel : ModelBase
{
public String A { get; set; }
public int B { get; set; }
public int C { get; set; }
}
}

@ -202,7 +202,7 @@ namespace NzbDrone.Core.Test
public string create_proper_sab_daily_titles(bool proper)
{
var series = Builder<Series>.CreateNew()
.With(c => c.SeriesTypes = SeriesTypes.Daily)
.With(c => c.SeriesType = SeriesTypes.Daily)
.With(c => c.Title = "My Series Name")
.Build();

@ -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<TSubject, TModel> : ObjectDbTest
public abstract class DbTest<TSubject, TModel> : 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<T>(IEnumerable<T> items) where T : new();
void Insert<T>(T item) where T : new();
IEnumerable<T> All<T>() where T : new();
void Update<T>(T childModel) where T : new();
void Delete<T>(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<T>(IEnumerable<T> items) where T : new()
{
_dbConnection.InsertAll(items);
}
public void Insert<T>(T item) where T : new()
{
_dbConnection.Insert(item);
}
public IEnumerable<T> All<T>() where T : new()
{
return _dbConnection.Select<T>();
}
public void Update<T>(T childModel) where T : new()
{
_dbConnection.Update(childModel);
}
public void Delete<T>(T childModel) where T : new()
{
_dbConnection.Delete(childModel);
}
}
}

@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HistoryTests
{
[TestFixture]
public class HistoryServiceTest : ObjectDbTest<HistoryRepository, History.History>
public class HistoryServiceTest : DbTest<HistoryRepository, History.History>
{
[Test]
public void Trim_Items()

@ -13,7 +13,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.InstrumentationTests
{
[TestFixture]
public class DatabaseTargetFixture : ObjectDbTest<DatabaseTarget, Log>
public class DatabaseTargetFixture : DbTest<DatabaseTarget, Log>
{
string _loggerName;

@ -18,7 +18,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.JobTests
{
[TestFixture]
public class JobRepositoryFixture : ObjectDbTest<JobRepository, JobDefinition>
public class JobRepositoryFixture : DbTest<JobRepository, JobDefinition>
{
FakeJob _fakeJob;
DisabledJob _disabledJob;

@ -9,7 +9,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.MediaFileTests
{
[TestFixture]
public class MediaFileRepositoryFixture : ObjectDbTest<MediaFileRepository, EpisodeFile>
public class MediaFileRepositoryFixture : DbTest<MediaFileRepository, EpisodeFile>
{
[Test]
public void get_files_by_series()

@ -93,6 +93,9 @@
<Reference Include="Microsoft.Practices.Unity.Configuration">
<HintPath>..\packages\Unity.2.1.505.2\lib\NET35\Microsoft.Practices.Unity.Configuration.dll</HintPath>
</Reference>
<Reference Include="Mono.Data.Sqlite">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
@ -115,6 +118,26 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Prowlin.0.9.4456.26422\lib\net40\Prowlin.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Common, Version=3.9.42.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ServiceStack.Common.3.9.42\lib\net35\ServiceStack.Common.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Interfaces">
<HintPath>..\packages\ServiceStack.Common.3.9.42\lib\net35\ServiceStack.Interfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.OrmLite">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.OrmLite.Sqlite">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.Sqlite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Text, Version=3.9.42.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ServiceStack.Text.3.9.42\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="SignalR, Version=0.5.1.10822, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SignalR.Server.0.5.3\lib\net40\SignalR.dll</HintPath>
@ -134,7 +157,7 @@
<Compile Include="Datastore\BasicRepositoryFixture.cs" />
<Compile Include="Datastore\ObjectDatabaseFixture.cs" />
<Compile Include="Framework\CoreTest.cs" />
<Compile Include="Framework\ObjectDbTest.cs" />
<Compile Include="Framework\DbTest.cs" />
<Compile Include="HelperTests\XElementHelperTests\ConvertToTFixture.cs" />
<Compile Include="IndexerSearchTests\DailyEpisodeSearchTests\IndexerDailyEpisodeSearchFixture.cs" />
<Compile Include="IndexerSearchTests\DailyEpisodeSearchTests\IndexerDailyEpisodeSearch_EpisodeMatch.cs" />
@ -293,6 +316,9 @@
<Content Include="Files\JsonError.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="sqlite\x64\sqlite3.dll" />
<Content Include="sqlite\x86\sqlite3.dll" />
<Content Include="sqlite\x86\sqlite3.exe" />
<None Include="Files\RSS\nzbx_search.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

@ -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<Series>
.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<Series>
.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<Series>
.CreateNew()
.With(s => s.SeriesTypes = SeriesTypes.Daily)
.With(s => s.SeriesType = SeriesTypes.Daily)
.With(s => s.Title = "The Daily Show with Jon Stewart")
.Build();

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
{
_series = Builder<Series>
.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]

@ -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 },
};

@ -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";

@ -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;

@ -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()

@ -11,6 +11,9 @@
<package id="NLog" version="2.0.0.2000" />
<package id="NUnit" version="2.6.2" targetFramework="net40" />
<package id="Prowlin" version="0.9.4456.26422" targetFramework="net40" />
<package id="ServiceStack.Common" version="3.9.42" targetFramework="net40" />
<package id="ServiceStack.OrmLite.Sqlite.Mono" version="3.9.42" targetFramework="net40" />
<package id="ServiceStack.Text" version="3.9.42" targetFramework="net40" />
<package id="SignalR.Server" version="0.5.3" targetFramework="net40" />
<package id="Unity" version="2.1.505.2" targetFramework="net40" />
</packages>

@ -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<Config>, 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);
}

@ -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<IDbFactory>().Create();
}).As<IDbConnection>().SingleInstance();
container.RegisterGeneric(typeof(BasicDb<>)).As(typeof(IBasicDb<>));
container.Register(c =>
{
return c.Resolve<IObjectDbFactory>().Create();
}).As<IObjectDatabase>().SingleInstance();
return c.Resolve<IDbFactory>().Create();
}).As<IDbConnection>().SingleInstance();
container.RegisterGeneric(typeof(BasicRepository<>)).As(typeof(IBasicRepository<>));

@ -1,126 +0,0 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using ServiceStack.OrmLite;
namespace NzbDrone.Core.Datastore
{
public interface IBasicDb<TModel> where TModel : ModelBase, new()
{
IEnumerable<TModel> 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<TModel> models);
void UpdateMany(IList<TModel> models);
void DeleteMany(List<TModel> models);
void Purge();
bool HasItems();
}
public class BasicDb<TModel> : IBasicDb<TModel> where TModel : ModelBase, new()
{
public BasicDb(IDbConnection database)
{
Database = database;
}
public IDbConnection Database { get; private set; }
public IEnumerable<TModel> All()
{
return Database.Select<TModel>();
}
public int Count()
{
return (int)Database.Count<TModel>();
}
public TModel Get(int id)
{
return Database.GetById<TModel>(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<TModel> models)
{
Database.InsertAll(models);
}
public void UpdateMany(IList<TModel> models)
{
Database.UpdateAll(models);
}
public void DeleteMany(List<TModel> 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<TModel>(id);
}
public void DeleteMany(IEnumerable<int> ids)
{
Database.DeleteByIds<TModel>(ids);
}
public void Purge()
{
Database.DeleteAll<TModel>();
}
public bool HasItems()
{
return Count() > 0;
}
}
}

@ -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<TModel> All();
int Count();
TModel Get(int id);
TModel Single();
TModel Single(Expression<Func<TModel, bool>> predicate);
TModel SingleOrDefault();
TModel SingleOrDefault(Expression<Func<TModel, bool>> predicate);
List<TModel> Where(Expression<Func<TModel, bool>> 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<TModel> InsertMany(IList<TModel> model);
IList<TModel> UpdateMany(IList<TModel> model);
void InsertMany(IList<TModel> model);
void UpdateMany(IList<TModel> model);
void DeleteMany(List<TModel> model);
void Purge();
bool HasItems();
void DeleteMany(IEnumerable<int> ids);
void UpdateOnly<TKey>(TModel model, Expression<Func<TModel, TKey>> onlyFields);
}
public class BasicRepository<TModel> : IBasicRepository<TModel> where TModel : ModelBase, new()
{
public BasicRepository(IObjectDatabase objectDatabase)
public BasicRepository(IDbConnection database)
{
ObjectDatabase = objectDatabase;
Database = database;
}
public IObjectDatabase ObjectDatabase { get; private set; }
protected IEnumerable<TModel> Queryable { get { return ObjectDatabase.AsQueryable<TModel>(); } }
public IDbConnection Database { get; private set; }
public IEnumerable<TModel> All()
{
return Queryable.ToList();
return Database.Select<TModel>();
}
public int Count()
{
return Queryable.Count();
return (int)Database.Count<TModel>();
}
public TModel Get(int id)
{
return Queryable.Single(c => c.Id == id);
return Database.GetById<TModel>(id);
}
public TModel Single()
public TModel Single(Expression<Func<TModel, bool>> 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<Func<TModel, bool>> predicate)
{
return Database.Select(predicate).SingleOrDefault();
}
public List<TModel> Where(Expression<Func<TModel, bool>> 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<TModel> InsertMany(IList<TModel> model)
public void InsertMany(IList<TModel> models)
{
return ObjectDatabase.InsertMany(model);
Database.InsertAll(models);
}
public IList<TModel> UpdateMany(IList<TModel> model)
public void UpdateMany(IList<TModel> models)
{
return ObjectDatabase.UpdateMany(model);
Database.UpdateAll(models);
}
public void DeleteMany(List<TModel> model)
public void DeleteMany(List<TModel> 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<TModel>(id);
}
public void DeleteMany(IEnumerable<int> ids)
{
foreach (var id in ids)
{
Delete(id);
}
Database.DeleteByIds<TModel>(ids);
}
public void Purge()
{
DeleteMany(Queryable.Select(c => c.Id));
Database.DeleteAll<TModel>();
}
public bool HasItems()
{
return Queryable.Any();
return Count() > 0;
}
public void UpdateOnly<TKey>(TModel model, Expression<Func<TModel, TKey>> onlyFields)
{
Database.UpdateOnly(model, onlyFields);
}
}
}

@ -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)

@ -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);
}
}
}

@ -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<Episode>();
_current.Episodes.Add(episode);
_current.Series = series;
// Return the now populated previous EpisodeFile (or null if first time through)
return prev;
}
}
}

@ -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<T> AsQueryable<T>();
T Insert<T>(T obj) where T : ModelBase;
T Update<T>(T obj) where T : ModelBase;
IList<T> InsertMany<T>(IList<T> objects) where T : ModelBase;
IList<T> UpdateMany<T>(IList<T> objects) where T : ModelBase;
void Delete<T>(T obj) where T : ModelBase;
void DeleteMany<T>(IEnumerable<T> objects) where T : ModelBase;
void UpdateField<T>(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<T> AsQueryable<T>()
{
return _db.LoadAllLazy<T>();
}
public T Insert<T>(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>(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<T> InsertMany<T>(IList<T> objects) where T : ModelBase
{
return DoMany(objects, Insert);
}
public IList<T> UpdateMany<T>(IList<T> objects) where T : ModelBase
{
return DoMany(objects, Update);
}
public void Delete<T>(T obj) where T : ModelBase
{
_db.Delete(obj);
}
public void DeleteMany<T>(IEnumerable<T> objects) where T : ModelBase
{
foreach (var o in objects)
{
Delete(o);
}
}
public void UpdateField<T>(T model, string fieldName) where T : ModelBase
{
_db.StoreObjectPartially(model, fieldName);
}
private IList<T> DoMany<T>(IEnumerable<T> objects, Func<T, T> function) where T : ModelBase
{
return objects.Select(function).ToList();
}
}
}

@ -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);
}

@ -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);
}

@ -65,7 +65,7 @@ namespace NzbDrone.Core.ExternalNotification
new ExternalNotificationDefinition { Name = Name };
updateAction(def);
_externalNotificationRepository.UpSert(def);
_externalNotificationRepository.Upsert(def);
}
private bool GetEnableStatus(Func<ExternalNotificationDefinition, bool> readFunction)

@ -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<ExternalNotificationDefinition>, 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());
}
}
}

@ -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<History>, 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)
{

@ -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<Indexer>, 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());
}
}
}

@ -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)

@ -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<NewznabDefinition>, INewznabRepository
{
public NewznabRepository(IObjectDatabase objectDatabase) : base(objectDatabase)
public NewznabRepository(IDbConnection database) : base(database)
{
}
public IEnumerable<NewznabDefinition> Enabled()
{
return Queryable.Where(n => n.Enabled);
return Where(n => n.Enabled);
}
}
}

@ -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; }

@ -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<Log>, 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);
}
}

@ -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)
{

@ -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<IJob> _jobs;
private readonly Logger _logger;
public JobRepository(IObjectDatabase objectDatabase, IEnumerable<IJob> jobs, Logger logger)
: base(objectDatabase)
public JobRepository(IDbConnection database, IEnumerable<IJob> 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<JobDefinition> 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);
}
}
}

@ -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<EpisodeFile>, 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<EpisodeFile> GetFilesBySeries(int seriesId)
{
return Queryable.Where(c => c.SeriesId == seriesId).ToList();
return Where(c => c.SeriesId == seriesId).ToList();
}
public List<EpisodeFile> 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();
}
}

@ -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);

@ -140,6 +140,9 @@
<HintPath>..\packages\MediaInfoNet.0.3\lib\MediaInfoDotNet.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Data.Sqlite">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
@ -161,17 +164,14 @@
<HintPath>..\packages\ServiceStack.Common.3.9.42\lib\net35\ServiceStack.Interfaces.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.OrmLite">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite32.3.9.42\lib\net40\ServiceStack.OrmLite.dll</HintPath>
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.OrmLite.SqliteNET">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite32.3.9.42\lib\net40\ServiceStack.OrmLite.SqliteNET.dll</HintPath>
<Reference Include="ServiceStack.OrmLite.Sqlite">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.42\lib\net35\ServiceStack.OrmLite.Sqlite.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text">
<HintPath>..\packages\ServiceStack.Text.3.9.42\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="siaqodb">
<HintPath>..\Libraries\Siaqodb\siaqodb.dll</HintPath>
</Reference>
<Reference Include="SignalR">
<HintPath>..\packages\SignalR.Server.0.5.3\lib\net40\SignalR.dll</HintPath>
</Reference>
@ -181,12 +181,6 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite">
<HintPath>..\packages\System.Data.SQLite.1.0.84.0\lib\net40\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.Linq">
<HintPath>..\packages\System.Data.SQLite.1.0.84.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web" />
@ -209,8 +203,6 @@
<Compile Include="Datastore\DbFactory.cs" />
<Compile Include="Datastore\ModelBase.cs" />
<Compile Include="Datastore\BasicRepository.cs" />
<Compile Include="Datastore\ObjectDbFactory.cs" />
<Compile Include="Datastore\SiaqodbProxy.cs" />
<Compile Include="DecisionEngine\DownloadDecision.cs" />
<Compile Include="DecisionEngine\IFetchableSpecification.cs" />
<Compile Include="DecisionEngine\Specifications\AcceptableSizeSpecification.cs" />
@ -582,12 +574,9 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NzbDrone.ico" />
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="x86\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="sqlite\x64\sqlite3.dll" />
<Content Include="sqlite\x86\sqlite3.dll" />
<Content Include="sqlite\x86\sqlite3.exe" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

@ -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));

@ -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)
{

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Providers
return new List<int>();
}
if (series.SeriesTypes == SeriesTypes.Daily)
if (series.SeriesType == SeriesTypes.Daily)
{
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
return new List<int>();
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Providers
return new List<int>();
}
if (series.SeriesTypes == SeriesTypes.Daily)
if (series.SeriesType == SeriesTypes.Daily)
{
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
return new List<int>();

@ -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<QualityProfile>, IQualityProfileRepository
{
public QualityProfileRepository(IObjectDatabase database)
public QualityProfileRepository(IDbConnection database)
: base(database)
{
}

@ -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<QualitySize>, 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);
}
}
}

@ -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<SceneMapping>, 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);
}
}
}

@ -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<UnmappedFolder> UnmappedFolders { get; set; }

@ -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);

@ -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);

@ -6,7 +6,7 @@ using ServiceStack.OrmLite;
namespace NzbDrone.Core.Tv
{
public interface ISeasonRepository : IBasicDb<Season>
public interface ISeasonRepository : IBasicRepository<Season>
{
IList<int> GetSeasonNumbers(int seriesId);
Season Get(int seriesId, int seasonNumber);
@ -14,7 +14,7 @@ namespace NzbDrone.Core.Tv
List<Season> GetSeasonBySeries(int seriesId);
}
public class SeasonRepository : BasicDb<Season>, ISeasonRepository
public class SeasonRepository : BasicRepository<Season>, ISeasonRepository
{
private readonly IDbConnection _database;

@ -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; }

@ -6,7 +6,7 @@ using ServiceStack.OrmLite;
namespace NzbDrone.Core.Tv
{
public interface ISeriesRepository : IBasicDb<Series>
public interface ISeriesRepository : IBasicRepository<Series>
{
bool SeriesPathExists(string path);
List<Series> Search(string title);
@ -15,7 +15,7 @@ namespace NzbDrone.Core.Tv
void SetSeriesType(int seriesId, SeriesTypes seriesTypes);
}
public class SeriesRepository : BasicDb<Series>, ISeriesRepository
public class SeriesRepository : BasicRepository<Series>, ISeriesRepository
{
public SeriesRepository(IDbConnection database)
: base(database)

@ -10,10 +10,9 @@
<package id="Prowlin" version="0.9.4456.26422" targetFramework="net40" />
<package id="RestSharp" version="104.1" targetFramework="net40" />
<package id="ServiceStack.Common" version="3.9.42" targetFramework="net40" />
<package id="ServiceStack.OrmLite.Sqlite32" version="3.9.42" targetFramework="net40" />
<package id="ServiceStack.OrmLite.Sqlite.Mono" version="3.9.42" targetFramework="net40" />
<package id="ServiceStack.Text" version="3.9.42" targetFramework="net40" />
<package id="SignalR.Hosting.Common" version="0.5.3" targetFramework="net40" />
<package id="SignalR.Server" version="0.5.3" targetFramework="net40" />
<package id="System.Data.SQLite" version="1.0.84.0" targetFramework="net40" />
<package id="twitterizer" version="2.4.0.26532" />
</packages>

@ -87,10 +87,6 @@
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>
<Reference Include="siaqodb, Version=3.6.0.0, Culture=neutral, PublicKeyToken=c9a50dde883b61a3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\Siaqodb\siaqodb.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
@ -102,7 +98,6 @@
<Compile Include="ApplicationServer.cs">
<SubType>Component</SubType>
</Compile>
<EmbeddedResource Include="licenses.licx" />
<Compile Include="NzbDroneBootstrapper.cs" />
<Compile Include="ApplicationMode.cs" />
<Compile Include="AppMain.cs" />

@ -1 +0,0 @@
Sqo.Siaqodb, siaqodb, Version=2.6.0.2,Culture=neutral,PublicKeyToken=c9a50dde883b61a3
Loading…
Cancel
Save