private void ERListFill() { using (db = new MyDBContext()) { db.EnergyResources.Load(); var qry2 = from o in db.EnergyResources where o.IsActual == 1 where o.IsPrime == 0 select new { o.Id, o.Name }; ERList.Clear(); foreach (var row in qry2) { ERList.Add(new EnergyResource() { Id = row.Id, Name = row.Id + "_" + row.Name }); } } }
private void ERListFill() { using (db = new MyDBContext()) { db.EnergyResources.Load(); var qrySource = from o in db.EnergyResources.ToList() select new EnergyResource { Id = o.Id, Name = o.Name, Unit = o.Unit, IsPrime = o.IsPrime, IsMain = o.IsMain, IsActual = o.IsActual }; ERList.Clear(); ERList = Global.ObservableCollection <EnergyResource>(qrySource); } }