Created
July 21, 2016 16:18
-
-
Save chamons/f21e6766d8102377744e9e997ad5bd4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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