Commit 1ab47d25 authored by Kirill's avatar Kirill

SQLite (sqlite-net-pcl)

parent bd519fc6
using System;
using System.IO;
using SQLite;
namespace TourDataManager {
public class Stock
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Symbol { get; set; }
}
public class Valuation
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[Indexed]
public int StockId { get; set; }
public DateTime Time { get; set; }
public decimal Price { get; set; }
}
public class Db {
public Db(string rootPath){
// Get an absolute path to the database file
var databasePath = Path.Combine(rootPath,"sandbox.sqlite");
var db = new SQLiteConnection(databasePath);
db.CreateTable<Stock>();
db.CreateTable<Valuation>();
}
}
}
\ No newline at end of file
...@@ -38,6 +38,26 @@ ...@@ -38,6 +38,26 @@
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath> <HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="SQLite-net, Version=1.5.231.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\sqlite-net-pcl.1.5.231\lib\netstandard1.1\SQLite-net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_green, Version=1.1.11.121, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f">
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_v2, Version=1.1.11.121, Culture=neutral, PublicKeyToken=8226ea5df37bcae9">
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.11\lib\net45\SQLitePCLRaw.batteries_v2.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCLRaw.core, Version=1.1.11.121, Culture=neutral, PublicKeyToken=1488e028ca7ab535">
<HintPath>..\packages\SQLitePCLRaw.core.1.1.11\lib\net45\SQLitePCLRaw.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=1.1.11.121, Culture=neutral, PublicKeyToken=9c301db686d0bd12">
<HintPath>..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.11\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -94,6 +114,7 @@ ...@@ -94,6 +114,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Authenticator.cs" /> <Compile Include="Authenticator.cs" />
<Compile Include="CookieStorage.cs" /> <Compile Include="CookieStorage.cs" />
<Compile Include="Db.cs" />
<Compile Include="Debug.cs" /> <Compile Include="Debug.cs" />
<Compile Include="IAuthenticator.cs" /> <Compile Include="IAuthenticator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
...@@ -103,6 +124,17 @@ ...@@ -103,6 +124,17 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets'))" />
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets'))" />
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" />
</Target>
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.11\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
<!-- 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.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Ninject" version="3.3.4" targetFramework="net472" /> <package id="Ninject" version="3.3.4" targetFramework="net472" />
<!--START sqlite-net-pcl -->
<package id="sqlite-net-pcl" version="1.5.231" targetFramework="net472" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.11" targetFramework="net472" />
<package id="SQLitePCLRaw.core" version="1.1.11" targetFramework="net472" />
<package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.1.11" targetFramework="net472" />
<package id="SQLitePCLRaw.lib.e_sqlite3.osx" version="1.1.11" targetFramework="net472" />
<package id="SQLitePCLRaw.lib.e_sqlite3.v110_xp" version="1.1.11" targetFramework="net472" />
<package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.1.11" targetFramework="net472" />
<!--END sqlite-net-pcl -->
<package id="System.IO" version="4.3.0" targetFramework="net472" /> <package id="System.IO" version="4.3.0" targetFramework="net472" />
<package id="System.Net.Http" version="4.3.3" targetFramework="net472" /> <package id="System.Net.Http" version="4.3.3" targetFramework="net472" />
<package id="System.Reactive" version="4.1.1" targetFramework="net472" /> <package id="System.Reactive" version="4.1.1" targetFramework="net472" />
...@@ -11,5 +20,4 @@ ...@@ -11,5 +20,4 @@
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" /> <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" /> <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" /> <package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net472" />
</packages> </packages>
\ No newline at end of file
...@@ -11,10 +11,10 @@ namespace TourDataManagerConsoleApplication { ...@@ -11,10 +11,10 @@ namespace TourDataManagerConsoleApplication {
public static void Main(string[] args){ public static void Main(string[] args){
var tourDataManager = new TourDataManager.TourDataManager(PersistentPath); //var tourDataManager = new TourDataManager.TourDataManager(PersistentPath);
tourDataManager.Login(defaultLogin, defaultPassword); //tourDataManager.Login(defaultLogin, defaultPassword);
new Db(PersistentPath);
Console.Read(); Console.Read();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment