static void Main(string[] args) { using (var db = new BloggingContext()) { // TODO Create the database // TODO Save data var blog = new Blog { Name = "The Dog Blog", Url = "http://sample.com/dogs" }; // TODO Query data } }
static void Main(string[] args) { using (var db = new BloggingContext()) { // Create the database db.Database.EnsureCreated(); // Save some data var blog = new Blog { Name = "The Dog Blog", Url = "http://sample.com/dogs" }; db.Blogs.Add(blog); db.SaveChanges(); // Query some data var blogs = db.Blogs.OrderBy(b => b.Name).ToList(); foreach (var item in blogs) { Console.WriteLine(item.Name); } } }