Skip to content

Instantly share code, notes, and snippets.

@chamons
Created July 21, 2016 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chamons/f21e6766d8102377744e9e997ad5bd4d to your computer and use it in GitHub Desktop.
Save chamons/f21e6766d8102377744e9e997ad5bd4d to your computer and use it in GitHub Desktop.
using System;
using CoreGraphics;
using Foundation;
using AppKit;
using ObjCRuntime;
using SQLite;
namespace SQClassicTest
{
public class Stock
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[MaxLength (8)]
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 partial class AppDelegate : NSApplicationDelegate
{
MainWindowController mainWindowController;
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
var db = new SQLiteConnection ("foofoo");
db.CreateTable<Stock> ();
db.CreateTable<Valuation> ();
var id = db.Insert (new Stock ()
{
Symbol = "MS"
});
var s = db.Find<Stock> (id);
Console.WriteLine ("{0} == {1}", s.Symbol, s.Id);
mainWindowController = new MainWindowController ();
mainWindowController.Window.MakeKeyAndOrderFront (this);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment