This question is locked. New answers and comments are not allowed.
i have a persistent class (" Resource ") and in this table i have a field with name " Culture " i need to query that retrieve all culture in this table that doesn`t repetitive i use below sql code to do this before :
select distinct Culture from resources
in orm and with linq i use this function :
and then i call this function to bind return values to RadComboBox like this :
protected void RadComboBoxCultures_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
RadComboBoxCultures.DataSource = resourceManager.RetrieveCultures();
RadComboBoxCultures.DataBind();
}
but i have this error :
Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Linq.IQueryable<EandE.Framework.Entities.Utilities.Resource>'. An explicit conversion exists (are you missing a cast?)
what is the right solution ? what is the right linq expression for distinct ? how can i do the right casting?
select distinct Culture from resources
in orm and with linq i use this function :
public IQueryable RetrieveCultures()
{
var query = (from q in scope.Extent<Resource>()
select new
{
q.Culture
}).Distinct();
return query;
}
and then i call this function to bind return values to RadComboBox like this :
protected void RadComboBoxCultures_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
RadComboBoxCultures.DataSource = resourceManager.RetrieveCultures();
RadComboBoxCultures.DataBind();
}
but i have this error :
Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Linq.IQueryable<EandE.Framework.Entities.Utilities.Resource>'. An explicit conversion exists (are you missing a cast?)
what is the right solution ? what is the right linq expression for distinct ? how can i do the right casting?