Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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