I have query
below, but when I try to format the field Data_nascimento
and Data_exclusao
with .ToString("dd/MM/yyyy")
it returns me a runtime error.
The 'System.String ToString (System.String)' method has no conversions supported in SQL.
var dependentes = (from dependentes in ctx.Tabela_DocsItens
where itens.Controle == dependentes.Controle_titular
select new listaDependentes
{
carteirinhaSegurado = dependentes.Cod_identific,
nomeSegurado = dependentes.Segurado,
dataNascimento = dependentes.Data_nascimento.Value.ToString("dd/MM/yyyy"),
dataExclusao = dependentes.Data_exclusao.Value.ToString("dd/MM/yyyy"),
}).ToList();
Is there any way to convert this to materialize the object?
In other words, does it throw a query
into the database that returns the data fields in the format I want?