7
I can do it:
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>();
In the select new
contains all class attributes vw_filial
. But, the visual Studio returns me the following error:
'System.Linq.Iqueryable' does not contain a definition for 'Tolist' and that 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 take the return of the expression, and store it on a list of the kind vw_filiais
.
You really solved my problem.
– Diego Moreno
And if select returns more than one table, I mean when it does a Join, which object would it return ?? because it would have a mixture of entities there.
– Fernando