static void Main(string[] args) { var databaseName = "MyDatabase"; if (Directory.Exists(databaseName)) { Directory.Delete(databaseName); } Directory.CreateDirectory(databaseName); Starcounter.Nova.Bluestar.ScCreateDb.Execute(databaseName); using (var appHost = new AppHostBuilder().UseDatabase(databaseName).Build()) { appHost.Start(); Db.Transact(() => { var p = Db.Insert <Person>(); p.FirstName = "Jane"; p.LastName = "Doe"; var o = Db.Insert <Another>(); o.Value = "Something"; }); Db.Transact(() => { var result = Db.SQL <Person>("SELECT p FROM Reprod.Person p").First; System.Console.WriteLine(result.FirstName); }); } }
static void Main(string[] args) { var databaseName = "MyDatabase"; if (Directory.Exists(databaseName)) { Directory.Delete(databaseName, true); } Directory.CreateDirectory(databaseName); Starcounter.Nova.Bluestar.ScCreateDb.Execute(databaseName); using (var appHost = new AppHostBuilder() .UseDatabase(databaseName) .UseTypes(typeSelector => typeSelector.AddTypes(GetTypes())) .Build()) { appHost.Start(); } }