Exemplo n.º 1
0
        private static async void SaveUser()
        {
            var r = new TableStorageRepository<User>(new DevelopmentStorageContext(), "Users");

            var user = new User
            {
                PartitionKey = "user",
                RowKey = "steve",
                Name = "Steve Hobbs",
            };

            r.BatchCommitted += (s, a) =>
            {
                Console.WriteLine("Committed..");
            };

            r.Insert(user);
            await r.CommitAsync();

            var user2 = await r.SingleAsync(new TableStorageKey("steve", "user"));

            if (user2 != null)
            {
                Console.WriteLine(user2.Name);
            }

            var users = await r.QueryAsync();
            users.ToList().ForEach(u => Console.WriteLine(u.RowKey));
        }