Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

Commented Issue: Empty SingleResult cannot be formatted by the ODataFormatter [1040]

$
0
0


public override SingleResult<Customer> GetCustomer(int key)
{
return SingleResult.Create(Enumerable.Empty<Customer>());
}
Comments: Yes, it is. The problem is that people return SingleResult<T> with code like this, ``` return SingleResult.Create(_db.Customers.Where(c => c.Id == id); ``` As you can see, figuring out whether there the singleresult is empty or not requires one more query which is not efficient. The expected behavior is 404 from the advisors call that we had the other day.

Viewing all articles
Browse latest Browse all 7925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>