I am trying to access the DbSet
function to load the entities. This function no longer exists in EF 6.0; upon certain investigation I foun
Also, besides System.Data.Entity, you must add the System.Linq namespace as well as System.Windows.
I found I needed to add:
using System.Data.Entity;
DbSet.ToList() will return all items from given set, and will populate the DbSet.Local property. You can call either ToList() or Load(). You do not need to reference Local property though, you could create manually ObservableCollection.
return new ObservbableCollection<Customer>(DataBaseContext.Set<Customer>().ToList());
There could be a difference between the ToList() and Local. If for example, this is not the first time you are executing a query on the customer set, Local could contain data that is invalid, if the data was deleted on the network.
In EF6 the class containing extension methods was renamed from DbQueryExtensions to QueryableExtensions but the .Load()
method is still there. If you are not calling this extension method directly the rename should not matter to you.