Skip to content

Instantly share code, notes, and snippets.

@appcoreopc
Created March 21, 2016 10:23
Show Gist options
  • Save appcoreopc/e6b4ee99147949b97896 to your computer and use it in GitHub Desktop.
Save appcoreopc/e6b4ee99147949b97896 to your computer and use it in GitHub Desktop.
public class CoreDataProvider
{
private SQLiteConnection _connection;
public CoreDataProvider(string appPath, ISQLitePlatform platform)
{
_connection = new SQLiteConnection(platform, appPath);
_connection.CreateTable<Stock>();
Insert(new Stock() { Symbol = "MSFT" });
Get();
}
public void Insert(Stock stockData)
{
_connection.Insert(stockData);
}
public void Get()
{
try
{
var result = _connection.Table<Stock>();
foreach (var item in result)
{
var a = item.Symbol;
}
}
catch (Exception ex)
{
string error = ex.Message;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment