Ich erhalte die folgende Ausnahme:Wie akzeptiere ich eine Anfrage und gebe eine asynchrone Aufgabe zurück?
Cannot create an EDM model as the action 'Get' on controller 'Accounts' has a return type 'System.Web.Http.IHttpActionResult' that does not implement IEnumerable<T>.
Beim Versuch, meinen Endpunkt abzufragen:
http://localhost:8267/api/accounts
Die AccountsController, die die Arbeit tun:
public async Task<IHttpActionResult> Get(ODataQueryOptions options)
{
var query = options.Request.RequestUri.PathAndQuery;
var client = new HttpClient();
var crmEndPoint = @"HTTPS://MYCRMORG.COM/API/DATA/V8.1/";
HttpResponseMessage response = await client.GetAsync(crmEndPoint+query);
object result;
if (response.IsSuccessStatusCode)
{
result = await response.Content.ReadAsAsync<object>();
return Ok(result);
}
return NotFound();
}
Was ich tue, falsch? Wie füge ich einfach die PathAndQuery zu meinem crmEndPoint hinzu und gebe das Ergebnis zurück?
Sollte nicht die OData Aktionsmethode Gebrauch 'IQueryable' als Rückgabetyp? –