當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。