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


C# CloudFilesProvider.DeleteObjectMetadata方法代码示例

本文整理汇总了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.DeleteObjectMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# CloudFilesProvider.DeleteObjectMetadata方法的具体用法?C# CloudFilesProvider.DeleteObjectMetadata怎么用?C# CloudFilesProvider.DeleteObjectMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.openstack.Providers.Rackspace.CloudFilesProvider的用法示例。


在下文中一共展示了CloudFilesProvider.DeleteObjectMetadata方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_Remove_Single_Metadata_For_Object_Item_Key1

        public void Should_Remove_Single_Metadata_For_Object_Item_Key1()
        {
            var provider = new CloudFilesProvider(_testIdentity);

            provider.DeleteObjectMetadata(containerName, objectName, "key1");
        }
开发者ID:brendanseabrook,项目名称:openstack.net,代码行数:6,代码来源:CloudFilesTests.cs

示例2: TestDeleteObjectMetaData

        public void TestDeleteObjectMetaData()
        {
            IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
            string containerName = TestContainerPrefix + Path.GetRandomFileName();
            string objectName = Path.GetRandomFileName();
            string objectData = "";

            ObjectStore result = provider.CreateContainer(containerName);
            Assert.AreEqual(ObjectStore.ContainerCreated, result);

            Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(objectData));
            provider.CreateObject(containerName, stream, objectName);
            Dictionary<string, string> metadata = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { "Key1", "Value 1" },
                { "Key2", "Value ²" },
                { "Key3", "Value 3" },
                { "Key4", "Value 4" },
            };

            provider.UpdateObjectMetadata(containerName, objectName, new Dictionary<string, string>(metadata, StringComparer.OrdinalIgnoreCase));

            Dictionary<string, string> actualMetadata = provider.GetObjectMetaData(containerName, objectName);
            Console.WriteLine("Object Metadata");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Check the overload which takes a single key
             */
            // remove Key3 first to make sure we still have a ² character in a remaining value
            metadata.Remove("Key3");
            provider.DeleteObjectMetadata(containerName, objectName, "Key3");

            actualMetadata = provider.GetObjectMetaData(containerName, objectName);
            Console.WriteLine("Object Metadata after removing Key3");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Check the overload which takes multiple keys
             */
            metadata.Remove("Key2");
            metadata.Remove("Key4");
            provider.DeleteObjectMetadata(containerName, objectName, new[] { "Key2", "Key4" });

            actualMetadata = provider.GetObjectMetaData(containerName, objectName);
            Console.WriteLine("Object Metadata after removing Key2, Key4");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Check that duplicate removal is a NOP
             */
            metadata.Remove("Key2");
            metadata.Remove("Key4");
            provider.DeleteObjectMetadata(containerName, objectName, new[] { "Key2", "Key4" });

            actualMetadata = provider.GetObjectMetaData(containerName, objectName);
            Console.WriteLine("Object Metadata after removing Key2, Key4");
            foreach (KeyValuePair<string, string> pair in actualMetadata)
                Console.WriteLine("    {0}: {1}", pair.Key, pair.Value);

            CheckMetadataCollections(metadata, actualMetadata);

            /* Cleanup
             */
            provider.DeleteContainer(containerName, deleteObjects: true);
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:72,代码来源:UserObjectStorageTests.cs

示例3: Should_Remove_Multiple_Metadata_For_Object_Items_Key2_and_Key3

        public void Should_Remove_Multiple_Metadata_For_Object_Items_Key2_and_Key3()
        {
            var provider = new CloudFilesProvider(_testIdentity);
            var metaData = new Dictionary<string, string> { { "key2", "value2" }, { "key3", "value3" } };

            provider.DeleteObjectMetadata(containerName, objectName, metaData);
        }
开发者ID:brendanseabrook,项目名称:openstack.net,代码行数:7,代码来源:CloudFilesTests.cs


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