public class Foo : DTableEntity
{
public string Name { get; set; }
public DateTime Birth { get; set; }
public decimal Salary { get; set; }
public List Friend { get; set; }
}
之後寫入就是舒爽:
var obj = new Foo();
obj.PartitionKey = "PK1";
obj.RowKey = "RK1";
obj.Name = "許當麻";
obj.Salary = 123456789.987654321m;
obj.Birth = new DateTime(1983, 05, 11);
var friend = new Foo();
friend.Name = "許當麻的朋友1";
friend.Salary = 123456789.987654321m;
friend.Birth = new DateTime(1983, 05, 11);
obj.Friend = new System.Collections.Generic.List();
obj.Friend.Add(friend);
var operation = Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertOrReplace(obj);
var res = CTable.ExecuteAsync(operation).Result;
讀取出來也是,不用再去特別處理 自訂物件跟 decimal 的處理 ,有需要的可以試試看 :)
--
The bug existed in all possible states.
Until I ran the code.