I am implementing Table storage in windows azure project. My code:
/// //// Method of _Table class
public CloudTableQuery<Html> AccessEntites()
{
CloudTableQuery<Html> entries =
(from e in ServiceContext.CreateQuery<Html>(TableName)
select e).AsTableServiceQuery();
return entries;
}
/// //
/// Controller code
private _Table db = new _Table("table-name");
public ViewResult Details(string id)
{
Html htmlfile = db.AccessEntites().Single(h => h.RowKey == id); <=========
return View(htmlfile);
}
//////
Problem here is that i am getting Exception Single method not supported. Can anybody tell me why ?
Apparently the LINQ provider for azure table storage doesn’t support the
Singlemethod, i.e. it cannot translate it at runtime to the appropriate query.Use
FirstOrDefaultinstead – https://www.windowsazure.com/en-us/develop/net/how-to-guides/table-services/#retrieve-single-entity