1

Azure テーブル ストレージにクエリを実行しようとしています。そのために、次の2つの方法を使用します。

テーブル サービス コンテキスト:

public IQueryable<T> QueryEntities<T>(string tableName) where T : TableServiceEntity
{
    this.ResolveType = (unused) => typeof(T);
    return this.CreateQuery<T>(tableName);
}

上記の方法を使用するコード:

CloudStorageAccount account = AzureConnector.GetCloudStorageAccount(AppSettingsVariables.TableStorageConnection);

AzureTableStorageContext context = new AzureTableStorageContext(account.TableEndpoint.ToString(), account.Credentials);

// Checks if the setting already exists in the Azure table storage. Returns null if not exists.
var existsQuery = from e in context.QueryEntities<ServiceSettingEntity>(TableName)
                  where e.ServiceName.Equals(this.ServiceName) && e.SettingName.Equals(settingName)
                  select e;

ServiceSettingEntity existingSettginEntity = existsQuery.FirstOrDefault();

上記の LINQ クエリは、次の要求 URL を生成します。

http://127.0.0.1:10002/devstoreaccount1/PublicSpaceNotificationSettingsTable()?$filter=(ServiceName eq 'PublicSpaceNotification') and (SettingName eq 'expectiss')

クラスのコードは、次の MissingMethodException を生成します。

ここに画像の説明を入力

しかし、私はこれを機能させることができません。

4

1 に答える 1

1

クラス「ServerSettingEntity」のパラメーターなしのコンストラクターがあることを確認してください。TableServiceEntity を継承する 'DTO' には、パラメーターのないコンストラクターが必要です。

于 2011-08-19T09:08:16.163 に答える