I can do this:
var filial = (from f in base.EntityContext.vw_filial
select f).ToList<vw_filial>();
But, I want to do something like this:
var filial = (from f in base.EntityContext.vw_filial
select new
{
COD_FILIAL = f.COD_FILIAL,
CGCCPF = f.CGCCPF,
NM_FILIAL = f.NM_FILIAL,
NMC_FILIAL = f.NMC_FILIAL,
END_FILIAL = f.END_FILIAL,
BAI_FILIAL = f.BAI_FILIAL,
CEP_FILIAL = f.CEP_FILIAL,
CID_FILIAL = f.CID_FILIAL,
UF_FILIAL = f.UF_FILIAL
}).ToList<vw_filial>();
No select new
contains all attributes of class vw_filial
. But, Visual Studio returns me the following error:
'System.Linq.IQueryable' does not contain a setting to 'ToList' and that the method 'System.Linq.ParallelEnumerable.ToList (System.Linq.ParallelQuery)' has some wrong arguments. ' 'System.Linq.IQueryable' does not contain a definiton for 'ToList' and the best extension method overload 'System.Linq.ParallelEnumerable.ToList (System.Linq.ParallelQuery)' has some invalid arguments.
What I need is to get the expression return, and store it in a list of type vw_filiais
.