I have a DbContext
used by a WPF client of a WCF service I 'host' in a Windows Service. Now, I don't know how this is related to what, in the WPF client, when I use the designer to place a SchedulerLogView
on my SchedulerView
, it shows as a red cross, and somewhere I can extract the error message
MissingMethodException: Method not found: 'System.Data.Entity.DbSet`1<Strategico.Eals.Services.Models.EalsLogEvent> Strategico.Eals.Data.Context.EalsDbContext.get_LogEvents()'.
This tells me the get
accessor for LogEvents
is missing. How can part of a Framework library be missing?
LogEvents
is defined inside public class
public classEalsDbContext: DbContext`:
public DbSet<EalsLogEvent> LogEvents { get; set; }
It is used inside public class LogViewModel
:
public ObservableCollection<EalsLogEvent> LogEvents { get; set; }
...
using (var db = new EalsDbContext())
{
var dbEvents = db.LogEvents.Where(e => e.PkId > max).ToList();
}
...
LogEvents.AddRange(dbEvents);
Which is bound to a DataGrid
inside SchedulerLogView
:
ItemsSource="{Binding LogEvents}"
I think you have to add reference to EntityFramework.dll
. I had the same issue. Turns out, you need the EntityFramework.dll
reference (and not System.Data.Entity
)
Install-Package EntityFramework