static void Main(string[] args) { SetupDatabase(); using (var db = new BloggingContext()) { var blog = new Blog(); blog.Name = "Rowan's Blog"; blog.SetUrl("http://romiller.com"); db.Blogs.Add(blog); db.SaveChanges(); var blogs = db.Blogs .OrderBy(b => EF.Property <string>(b, "Url")) .ToList(); } }
static void Main(string[] args) { SetupDatabase(); using (var db = new BloggingContext()) { var blog = new Blog(); blog.Name = "Rowan's Blog"; blog.SetUrl("http://romiller.com"); db.Blogs.Add(blog); db.SaveChanges(); var blogs = db.Blogs .OrderBy(b => b.Url) .ToList(); } }
static void Main(string[] args) { SetupDatabase(); using (var db = new BloggingContext()) { Console.WriteLine("Setting properties through C#"); var blog = new Blog { Name = ".NET Musings" }; blog.SetUrl("http://www.saikiranpotru.blogspot.com"); db.Blogs.Add(blog); db.SaveChanges(); Console.WriteLine("Setting properties through EF materialization"); var blogs = db.Blogs.OrderBy(b => EF.Property <string>(b, "Url")).ToList(); foreach (var b in blogs) { Console.WriteLine($"{b.Name} ({b.GetUrl()})"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); } }
static void Main(string[] args) { SetupDatabase(); using (var db = new BloggingContext()) { Console.WriteLine("Setting properties through C#"); var blog = new Blog { Name = ".NET Musings" }; blog.Url = "http://www.skimedic.com"; db.Blogs.Add(blog); db.SaveChanges(); Console.WriteLine("Setting properties through EF materialization"); var blogs = db.Blogs.OrderBy(b => b.Url).ToList(); foreach (var b in blogs) { Console.WriteLine($"{b.Name} ({b.Url})"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); } }