I have the following model called Conta
:
public int Codigo { get; set; }
public string Nome { get; set; }
public int Prazo { get; set; }
Assuming I want to do a select (without using lambda) and just bring the Name property, in this case I've created a struct:
struct getNomeConta
{
public string Nome { get; set; }
}
and I made the select:
getNomeConta = db.Database.SqlQuery<getNomeConta>(strSql).FirstOrDefault();
where strSQl
is my SQL string that returns the value of the name only.
This code has been rushed to meet the requester, but I want to change it, preferably using lambda to do the select, but only the name (without loading the model Conta
integer)