Why this is giving me the parameterless contructor error?
ObservableCollection<ArchivioErogazioniForList> tempHP = new ObservableCollection<ArchivioErogazioniForList>();
var erogazioniFiltrate = from r in MainWindow.dbContext.ArchivioErogazioni
where termToFind.Contains(r.IDTER.Value) && r.DATA_EROG >= test
select r;
tempHP = new ObservableCollection<ArchivioErogazioniForList>(erogazioniFiltrate.Where(x => x.DATA_EROG >= test).Select(x => new ArchivioErogazioniForList(x)));
while this is working??
private ObservableCollection<ArchivioErogazioniForList> p_ListaMonitorErogazioni2;
public ObservableCollection<ArchivioErogazioniForList> ListaMonitorErogazioni2
{
get { return p_ListaMonitorErogazioni2; }
set {
p_ListaMonitorErogazioni2 = value;
base.RaisePropertiesChanged("ListaMonitorErogazioni2");
}
}
allRecords = (from r in MainWindow.dbContext.ArchivioErogazioni select r).ToList();
ListaMonitorErogazioni2 = new ObservableCollection<ArchivioErogazioniForList>(allRecords.Where(x => x.DATA_EROG >= startDate && x.DATA_EROG <= endDate).Select(x => new ArchivioErogazioniForList(x)));
Where are the differences? The first snippet give me the error "System.NotSupportedException: Only parameterless constructors and initializers are supported in LINQ to Entities."