public static void Main() { using (var db = new MyContext()) { db.Database.EnsureCreatedAsync().Wait(); } using (var db = new MyContext()) { // TODO Remove when identity columns work end-to-end var nextId = db.Blogs.Any() ? db.Blogs.Max(b => b.BlogId) + 1 : 1; db.Add(new Blog { BlogId = nextId, Name = "Another Blog", Url = "http://example.com" }); db.SaveChangesAsync().Wait(); var blogs = db.Blogs.OrderBy(b => b.Name); foreach (var item in blogs) { Console.WriteLine(item.Name); } } }