示例#1
0
 public void Test04()
 {
     Credentials credentials = new Credentials(ACCOUNT_NAME, KEY);
     DynamicTableContext context = new DynamicTableContext(TABLE_NAME, credentials);
     dynamic item = new { PartitionKey = "1", RowKey = Guid.NewGuid().ToString(), Value = "Hello World" };
     context.InsertOrReplace(item);
 }
示例#2
0
        public void Test09()
        {
            Credentials         credentials = new Credentials(ACCOUNT_NAME, KEY);
            DynamicTableContext context     = new DynamicTableContext(TABLE_NAME, credentials);
            dynamic             item        = context.Get("1", "999"); // item does not exist

            Assert.IsNull(item);
        }
示例#3
0
 public void Setup()
 {
     var account = new CloudStorageAccount(new StorageCredentialsAccountAndKey(ACCOUNT_NAME, KEY), false);
     var tableClient = account.CreateCloudTableClient();
     tableClient.CreateTableIfNotExist(TABLE_NAME);
     var context = new DynamicTableContext(TABLE_NAME, new Credentials(ACCOUNT_NAME, KEY));
     context.InsertOrReplace(new { PartitionKey = "1", RowKey = "1", Value1 = "TEST" });
 }
示例#4
0
        public void Test04()
        {
            Credentials         credentials = new Credentials(ACCOUNT_NAME, KEY);
            DynamicTableContext context     = new DynamicTableContext(TABLE_NAME, credentials);
            dynamic             item        = new { PartitionKey = "1", RowKey = Guid.NewGuid().ToString(), Value = "Hello World" };

            context.InsertOrReplace(item);
        }
示例#5
0
        public void Test08()
        {
            Credentials         credentials = new Credentials(ACCOUNT_NAME, KEY);
            DynamicTableContext context     = new DynamicTableContext(TABLE_NAME, credentials);
            dynamic             item        = new { PartitionKey = "1", RowKey = "1", Value = "Hello World" };

            context.Insert(item);
        }
示例#6
0
 public void Test02()
 {
     Credentials credentials = new Credentials(ACCOUNT_NAME, KEY);
     DynamicTableContext context = new DynamicTableContext(TABLE_NAME, credentials);
     dynamic item = context.Get("1", "1");
     Assert.IsNotNull(item);
     Assert.AreEqual("1", item.PartitionKey);
     Assert.AreEqual("1", item.RowKey);
 }
示例#7
0
 public void Test05()
 {
     Credentials credentials = new Credentials(ACCOUNT_NAME, KEY);
     DynamicTableContext context = new DynamicTableContext(TABLE_NAME, credentials);
     dynamic item = new ExpandoObject();
     item.PartitionKey = "1";
     item.RowKey = Guid.NewGuid().ToString();
     item.Value = "Hello World";
     context.Insert(item);
 }
示例#8
0
        public void Setup()
        {
            var account     = new CloudStorageAccount(new StorageCredentialsAccountAndKey(ACCOUNT_NAME, KEY), false);
            var tableClient = account.CreateCloudTableClient();

            tableClient.CreateTableIfNotExist(TABLE_NAME);
            var context = new DynamicTableContext(TABLE_NAME, new Credentials(ACCOUNT_NAME, KEY));

            context.InsertOrReplace(new { PartitionKey = "1", RowKey = "1", Value1 = "TEST" });
        }
示例#9
0
        public void Test02()
        {
            Credentials         credentials = new Credentials(ACCOUNT_NAME, KEY);
            DynamicTableContext context     = new DynamicTableContext(TABLE_NAME, credentials);
            dynamic             item        = context.Get("1", "1");

            Assert.IsNotNull(item);
            Assert.AreEqual("1", item.PartitionKey);
            Assert.AreEqual("1", item.RowKey);
        }
示例#10
0
        public void Test07()
        {
            Credentials         credentials = new Credentials(ACCOUNT_NAME, KEY);
            DynamicTableContext context     = new DynamicTableContext(TABLE_NAME, credentials);
            var dictionary = new Dictionary <string, object>();

            dictionary["PartitionKey"] = "2";
            dictionary["RowKey"]       = "2";
            dictionary["Value3"]       = "FooBar";
            context.InsertOrReplace(dictionary);
        }
示例#11
0
        public void Test06()
        {
            Credentials         credentials = new Credentials(ACCOUNT_NAME, KEY);
            DynamicTableContext context     = new DynamicTableContext(TABLE_NAME, credentials);
            dynamic             item        = new ExpandoObject();

            item.PartitionKey = "1";
            item.RowKey       = Guid.NewGuid().ToString();
            item.Value        = "Hello World";
            context.InsertOrMerge(item);
        }
示例#12
0
 public void Test01()
 {
     Credentials credentials = new Credentials(ACCOUNT_NAME, KEY);
     DynamicTableContext context = new DynamicTableContext(TABLE_NAME, credentials);
     foreach (IDictionary<string, object> item in context.Query("Value1 eq 'TEST'"))
     {
         foreach (string key in item.Keys)
         {
             Console.WriteLine(key + " = " + item[key]);
         }
     }
 }
示例#13
0
        public void Test01()
        {
            Credentials         credentials = new Credentials(ACCOUNT_NAME, KEY);
            DynamicTableContext context     = new DynamicTableContext(TABLE_NAME, credentials);

            foreach (IDictionary <string, object> item in context.Query("Value1 eq 'TEST'"))
            {
                foreach (string key in item.Keys)
                {
                    Console.WriteLine(key + " = " + item[key]);
                }
            }
        }
示例#14
0
 public void Test07()
 {
     Credentials credentials = new Credentials(ACCOUNT_NAME, KEY);
     DynamicTableContext context = new DynamicTableContext(TABLE_NAME, credentials);
     var dictionary = new Dictionary<string, object>();
     dictionary["PartitionKey"] = "2";
     dictionary["RowKey"] = "2";
     dictionary["Value3"] = "FooBar";
     context.InsertOrReplace(dictionary);
 }
示例#15
0
 public void Test09()
 {
     Credentials credentials = new Credentials(ACCOUNT_NAME, KEY);
     DynamicTableContext context = new DynamicTableContext(TABLE_NAME, credentials);
     dynamic item = context.Get("1", "999"); // item does not exist
     Assert.IsNull(item);
 }
示例#16
0
 public void Test00()
 {
     var context = new DynamicTableContext(null, null);
 }
示例#17
0
 public void Test00()
 {
     var context = new DynamicTableContext(null, null);
 }
示例#18
0
 public void Test08()
 {
     Credentials credentials = new Credentials(ACCOUNT_NAME, KEY);
     DynamicTableContext context = new DynamicTableContext(TABLE_NAME, credentials);
     dynamic item = new { PartitionKey = "1", RowKey = "1", Value = "Hello World" };
     context.Insert(item);
 }