本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.Entities.ComplexEntity.ReadEntity方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexEntity.ReadEntity方法的具体用法?C# ComplexEntity.ReadEntity怎么用?C# ComplexEntity.ReadEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Table.Entities.ComplexEntity
的用法示例。
在下文中一共展示了ComplexEntity.ReadEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TableRetrieveEntityPropertySetter
public void TableRetrieveEntityPropertySetter()
{
CloudTableClient tableClient = GenerateCloudTableClient();
string pk = Guid.NewGuid().ToString();
// Add insert
ComplexEntity sendEnt = new ComplexEntity();
sendEnt.PartitionKey = pk;
sendEnt.RowKey = Guid.NewGuid().ToString();
Dictionary<string, EntityProperty> properties = new Dictionary<string, EntityProperty>();
EntityProperty prop1 = properties["BoolN"] = EntityProperty.GeneratePropertyForBool(null);
sendEnt.BoolN = prop1.BooleanValue = true;
EntityProperty prop2 = properties["DoubleN"] = EntityProperty.GeneratePropertyForDouble(null);
sendEnt.DoubleN = prop2.DoubleValue = 3.1415;
EntityProperty prop3 = properties["GuidN"] = EntityProperty.GeneratePropertyForGuid(null);
sendEnt.GuidN = prop3.GuidValue = Guid.NewGuid();
EntityProperty prop4 = properties["Int32N"] = EntityProperty.GeneratePropertyForInt(null);
sendEnt.Int32N = prop4.Int32Value = 1;
EntityProperty prop5 = properties["Int64N"] = EntityProperty.GeneratePropertyForLong(null);
sendEnt.Int64N = prop5.Int64Value = 1234;
EntityProperty prop6 = properties["String"] = EntityProperty.GeneratePropertyForString(null);
sendEnt.String = prop6.StringValue = "hello";
EntityProperty prop7 = properties["DateTimeOffsetN"] = EntityProperty.GeneratePropertyForDateTimeOffset(null);
sendEnt.DateTimeOffsetN = prop7.DateTimeOffsetValue = DateTimeOffset.UtcNow;
ComplexEntity retrievedEntity = new ComplexEntity();
retrievedEntity.ReadEntity(properties, null);
Assert.AreEqual(sendEnt.BoolN, retrievedEntity.BoolN);
Assert.AreEqual(sendEnt.DoubleN, retrievedEntity.DoubleN);
Assert.AreEqual(sendEnt.GuidN, retrievedEntity.GuidN);
Assert.AreEqual(sendEnt.Int32N, retrievedEntity.Int32N);
Assert.AreEqual(sendEnt.Int64N, retrievedEntity.Int64N);
Assert.AreEqual(sendEnt.String, retrievedEntity.String);
Assert.AreEqual(sendEnt.DateTimeOffsetN, retrievedEntity.DateTimeOffsetN);
}
示例2: ReflectionBasedSerializationTest
public void ReflectionBasedSerializationTest()
{
ComplexEntity ent = new ComplexEntity();
ComplexEntity secondEnt = new ComplexEntity();
secondEnt.ReadEntity(ent.WriteEntity(null), null);
ComplexEntity.AssertEquality(ent, secondEnt);
}