xxxxxxxxxx
1
using System;
2
using System.Linq;
3
using System.Collections.Generic;
4
using ServiceStack;
5
using ServiceStack.Text;
6
using ServiceStack.OrmLite;
7
using ServiceStack.OrmLite.Sqlite;
8
9
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
10
var db = dbFactory.OpenDbConnection();
11
12
//DROP and CREATE Artist and Track Tables from their POCO definition
13
db.DropAndCreateTable<Artist>();
14
db.DropAndCreateTable<Track>();
15
16
//INSERT each Artist, including their Track references
17
Seed.Artists.Each(x => db.Save(x, references:true));
18
19
//SELECT all artists including their Track references
20
var allArtists = db.LoadSelect<Artist>();
21
allArtists.PrintDump();
22
23
Inspect.vars(new { allArtists });
run
Loading
OrmLite Tour
by @gistlyn
on gist.cafe