Exemplo n.º 1
0
        public static void Run()
        {
            var connectionString = ConfigurationManager.AppSettings["StorageConnectionString"];
            var account          = CloudStorageAccount.Parse(connectionString);
            var client           = account.CreateCloudTableClient();

            var table = client.GetTableReference("Movies");

            table.Create();

            var movie1 = new MovieEntity("sci-fi", "Star Wars IV - A New Hope")
            {
                Year        = 1977,
                Length      = "2hr, 1min",
                Description = "Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a Wookiee and two droids to save the galaxy from the Empire's world-destroying battle-station while also attempting to rescue Princess Leia from the evil Darth Vader."
            };
            var movie2 = new MovieEntity("sci-fi", "Star Wars V - The Empire Strikes Back")
            {
                Year        = 1980,
                Length      = "2hr, 4min",
                Description = "After the rebels are overpowered by the Empire on the ice planet Hoth, Luke Skywalker begins Jedi training with Yoda. His friends accept shelter from a questionable ally as Darth Vader hunts them in a plan to capture Luke."
            };
            var batchOperation = new TableBatchOperation();

            batchOperation.Insert(movie1);
            batchOperation.Insert(movie2);
            table.ExecuteBatch(batchOperation);
        }
Exemplo n.º 2
0
 private static void AddSciFiMovie(CloudTable table)
 {
     var movie = new MovieEntity("sci-fi", "Star Wars VI - Return of the Jedi")
     {
         Year        = 1983,
         Length      = "2hr, 11min",
         Description = "After a daring mission to rescue Han Solo from Jabba the Hutt, the rebels dispatch to Endor to destroy a more powerful Death Star. Meanwhile, Luke struggles to help Vader back from the dark side without falling into the Emperor's trap."
     };
     var insertOperation = TableOperation.Insert(movie);
     var result          = table.Execute(insertOperation);
 }