コード例 #1
0
        public void ShouldSaveAndRetrieveCustomEntity()
        {
            var account = CloudConfiguration.GetStorageAccount("DataConnectionString");

            var key          = Guid.NewGuid().ToString();
            var customEntity = new CustomEntity()
            {
                PartitionKey = "CustomEntity",
                RowKey       = key,
                Id           = 5,
                Name         = "five"
            };

            var udfAzureTable = new UDFAzureTable(account, TableName);

            udfAzureTable.Save(customEntity);

            var storedEntity = udfAzureTable.BuildQueryFor(customEntity.GetType())
                               .Where(e => e.PartitionKey.Equals("CustomEntity") && e.RowKey.Equals(key))
                               .FirstOrDefault();

            Assert.IsNotNull(storedEntity);
            Assert.AreEqual(customEntity.ToString(), storedEntity.ToString());
        }
コード例 #2
0
 public static string ToStr(this CustomEntity entity)
 {
     return($"Name={entity.Name}, Desc={entity.Description}, Type={entity.GetType()}, OwningEntityId={entity.OwningEntityId}, IsCustomEntity={!NotCustomEntityTheOwningEntity(entity)}");
 }