I’m using Entity Framework 4.3.1 Code First and I have something similar to the following:
class Program
{
static void Main(string[] args)
{
// get LogEntry with id x..
}
}
public class MyContext : DbContext
{
public DbSet<Log> Logs { get; set; }
}
public class Log
{
public int LogId { get; set; }
public ICollection<LogEntry> LogEntries { get; set; }
}
public class LogEntry
{
public int LogEntryId { get; set; }
}
What’s the best way to get a LogEntry object given an integer LogEntryId? Is it possible to get the entity directly without going via the Log.LogEntries property?
If you have a reference to the context, then