-Replaced Mono.Data.SQLite by System.Data.SQLite(ManagedOnly)

-Added System.Data.SQLite and Sqlite3 into ThirdParty
-Depending of the OS, System.Data.SQLite will look for:
  sqlite3.dll in Windows(Provided with the project)
  libsqlite3.so.0 in Linux(Need to be installed. ie yum install sqlite.i686)
  libsqlite3.dylib in MacOS X(!?)
  (See http://www.mono-project.com/Interop_with_Native_Libraries for more info)
This commit is contained in:
abeloin 2013-12-25 19:40:53 -05:00
parent 68cf16416b
commit 316500dca4
3 changed files with 22 additions and 23 deletions

View File

@ -48,9 +48,6 @@
<Reference Include="Alchemy"> <Reference Include="Alchemy">
<HintPath>..\packages\Alchemy.2.2.1\lib\net40\Alchemy.dll</HintPath> <HintPath>..\packages\Alchemy.2.2.1\lib\net40\Alchemy.dll</HintPath>
</Reference> </Reference>
<Reference Include="Mono.Data.Sqlite">
<HintPath>..\ThirdParty\Mono.Data.Sqlite\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Api.Swagger"> <Reference Include="ServiceStack.Api.Swagger">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll</HintPath> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll</HintPath>
</Reference> </Reference>
@ -67,9 +64,14 @@
<Reference Include="BDInfo"> <Reference Include="BDInfo">
<HintPath>..\packages\MediaBrowser.BdInfo.1.0.0.5\lib\net20\BDInfo.dll</HintPath> <HintPath>..\packages\MediaBrowser.BdInfo.1.0.0.5\lib\net20\BDInfo.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Data.SQLite"> <Reference Include="System.Data.SQLite" Condition=" '$(ConfigurationName)' != 'Release Mono' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\System.Data.SQLite.x86.1.0.89.0\lib\net45\System.Data.SQLite.dll</HintPath> <HintPath>..\packages\System.Data.SQLite.x86.1.0.89.0\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Data.SQLite" Condition=" '$(ConfigurationName)' == 'Release Mono' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\System.Data.SQLite.ManagedOnly\x86\1.0.90.0\net40\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="ServiceStack"> <Reference Include="ServiceStack">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.dll</HintPath> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.dll</HintPath>
</Reference> </Reference>
@ -346,6 +348,16 @@
</Content> </Content>
<EmbeddedResource Include="Localization\Ratings\be.txt" /> <EmbeddedResource Include="Localization\Ratings\be.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="..\ThirdParty\System.Data.SQLite.ManagedOnly\x86\1.0.90.0\net40\System.Data.SQLite.dll">
<Link>System.Data.SQLite.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\System.Data.SQLite.ManagedOnly\x86\1.0.90.0\net40\System.Data.SQLite.Linq.dll">
<Link>System.Data.SQLite.Linq.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " /> <Import Project="$(SolutionDir)\.nuget\nuget.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -1,11 +1,7 @@
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System; using System;
using System.Data; using System.Data;
#if __MonoCS__
using Mono.Data.Sqlite;
#else
using System.Data.SQLite; using System.Data.SQLite;
#endif
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -140,18 +136,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
logger.Info("Opening {0}", dbPath); logger.Info("Opening {0}", dbPath);
#if __MonoCS__
var connectionstr = new SqliteConnectionStringBuilder
{
PageSize = 4096,
CacheSize = 4096,
SyncMode = SynchronizationModes.Normal,
DataSource = dbPath,
JournalMode = SQLiteJournalModeEnum.Off
};
var connection = new SqliteConnection(connectionstr.ConnectionString);
#else
var connectionstr = new SQLiteConnectionStringBuilder var connectionstr = new SQLiteConnectionStringBuilder
{ {
PageSize = 4096, PageSize = 4096,
@ -162,7 +146,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
}; };
var connection = new SQLiteConnection(connectionstr.ConnectionString); var connection = new SQLiteConnection(connectionstr.ConnectionString);
#endif
await connection.OpenAsync().ConfigureAwait(false); await connection.OpenAsync().ConfigureAwait(false);
return connection; return connection;

View File

@ -128,8 +128,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
<None Include="sqlite3.dll"> </ItemGroup>
<ItemGroup>
<Content Include="..\ThirdParty\SQLite3\x86\3.8.2\sqlite3.dll">
<Link>sqlite3.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </Content>
</ItemGroup> </ItemGroup>
</Project> </Project>