I have this error in this linq expression :
var naleznosci = (from nalTmp in db.Naleznosci
where nalTmp.idDziecko == idDziec
select new Payments
(
nalTmp.Dziecko.Imie,
nalTmp.Dziecko.Nazwisko,
nalTmp.Miesiace.Nazwa,
nalTmp.Kwota,
nalTmp.RodzajeOplat.NazwaRodzajuOplaty,
nalTmp.RodzajeOplat.TypyOplat.NazwaTypuOplaty,
nalTmp.DataRozliczenia,
nalTmp.TerminPlatnosci
)).ToList();
Any idea how solve this problem? I try with any combination of expression... :/
If you're like me and don't want to have to populate your properties for each query you're building, there is another way to solve this issue.
At this point you have an IQueryable containing an anonymous object. If you want to populate your custom object with a constructor you can simply do something like this:
Now your custom object (which takes two objects as a parameter) can populate your properties as needed.