If I have a page class that returns an IQueryable result set like:
protected virtual IQueryable<EntityResult> GetEntities(ETBDataContext pContext)
{
return from e in pContext.Entities
where e.SectionId == SectionId && e.StatusCode == "Published"
orderby e.PublishDate descending
select new EntityResult
{
EntityId = e.Id,
Excerpt = e.Excerpt,
Name = e.Name,
PublishDate = e.PublishDate,
ShortDescription = e.ShortDescription
};
}
If I call this method in a inherited class, How can I clear the select and just get the ShortDescription?
public void IQueryable<EntityResult> GetResult(ETBDataContext pContext)
{
IQueryable<EntityResult> pQuery = base.GetEntities(pContext);
//right here: how can I just return the ShortDescription Only?
return pQuery;
}
I am using the default GetEntities() to do the standard select operation for default queries, but on some calls I would like to get just the specific data that I need.
Is this possible? are there other ways? Thanks in advance!!
You can try
I’m pretty sure that this won’t select the other columns.