Getter properties not found for `DbSet`s on my `Context`

c# data-binding entity-framework entity-framework-6 wcf

Question

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 classpublic 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}"
1
1
3/12/2015 4:04:36 AM

Popular Answer

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
0
3/13/2015 1:37:44 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow