Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            using (var context = new MusicContext())
            {
                context.Albums.Add(new Album()
                {
                    Title = "My Album",
                    Price = 9.99m
                });

                context.SaveChanges();

                foreach (var album in context.Albums.ToList())
                {
                    Console.WriteLine(
                        string.Format("Id:{0}\nTitle:{1}\nPrice:{2}\n\n",
                                      album.AlbumId, album.Title, album.Price));
                }
            }

            Console.WriteLine("Press enter to continue...");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            using (var context = new MusicContext())
            {
                context.Albums.Add(new Album()
                {
                    Title = "My Album",
                    Price = 9.99m
                });

                context.SaveChanges();

                foreach (var album in context.Albums.ToList())
                {
                    Console.WriteLine(
                        string.Format("Id:{0}\nTitle:{1}\nPrice:{2}\n\n", 
                        album.AlbumId, album.Title, album.Price));
                }
            }

            Console.WriteLine("Press enter to continue...");
            Console.ReadLine();

        }