当前位置: 首页>>代码示例>>C#>>正文


C# ComplexEntity.ReadEntity方法代码示例

本文整理汇总了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);
        }
开发者ID:rwalka,项目名称:azure-storage-net,代码行数:44,代码来源:TableOperationUnitTests.cs

示例2: ReflectionBasedSerializationTest

 public void ReflectionBasedSerializationTest()
 {
     ComplexEntity ent = new ComplexEntity();
     ComplexEntity secondEnt = new ComplexEntity();
     secondEnt.ReadEntity(ent.WriteEntity(null), null);
     ComplexEntity.AssertEquality(ent, secondEnt);
 }
开发者ID:benaadams,项目名称:azure-storage-net,代码行数:7,代码来源:TableEntitySerializationTests.cs


注:本文中的Microsoft.WindowsAzure.Storage.Table.Entities.ComplexEntity.ReadEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。