0

テーブル ストレージからエンティティを読み取るために使用しているコードのスニペットを次に示します。

public void OnReadingEntity(object sender, ReadingWritingEntityEventArgs args)
    {
        XNamespace AtomNamespace = "http://www.w3.org/2005/Atom";
        XNamespace AstoriaMetadataNamespace = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";

        GenericEntity entity = args.Entity as GenericEntity;
        if (entity == null)
        {
            return;
        }

        // read each property, type and value in the payload   
        var properties = args.Entity.GetType().GetProperties();
        var q = from p in args.Data.Element(AtomNamespace + "content")
                                .Element(AstoriaMetadataNamespace + "properties")
                                .Elements()
                where properties.All(pp => pp.Name != p.Name.LocalName)
                select new
                {
                    Name = UnescapePropertyName(p.Name.LocalName),
                    IsNull = string.Equals("true", p.Attribute(AstoriaMetadataNamespace + "null") == null 
                        ? null 
                        : p.Attribute(AstoriaMetadataNamespace + "null").Value, StringComparison.OrdinalIgnoreCase),
                    TypeName = p.Attribute(AstoriaMetadataNamespace + "type") == null 
                        ? null 
                        : p.Attribute(AstoriaMetadataNamespace + "type").Value,
                    p.Value
                };

        foreach (var dp in q)
        {
            entity[dp.Name] = GetTypedEdmValue(dp.TypeName, dp.Value, dp.IsNull);
        }
    }

残念ながら、このコードは、削除したエンティティに存在するいくつかのプロパティを返します。

誰かがその理由を説明できますか?

4

1 に答える 1

1

Azure テーブル ストレージには、リレーショナル データベースで慣れているような列がありません。各行は、必須の列以外に完全に異なるプロパティを持つことができます。

「まだ表示されている」と言うとき、これは、使用しているツールがリレーショナル テーブルのように思わせるデータを表示する方法にすぎないと思います。

優れた技術的背景については、 http://msdn.microsoft.com/en-us/magazine/ff796231.aspxを参照してください。

于 2012-05-25T07:27:50.050 に答える