You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var news = context.News.Include(p => p.Feed).Where(p => p.Feed.ShowOnMainPage).AsNoTracking().ToList();
Generate the following SQL statements.
SELECT "p"."Id", "p"."DateAdded", "p"."Description", "p"."FeedId", "p"."FullText", "p"."Guid", "p"."IsFavourite", "p"."IsRead", "p"."Link", "p"."PubDate", "p"."Title", "f"."Id", "f"."Description", "f"."Encoding", "f"."FeedUrl", "f"."IncludeImageInNotification", "f"."Logo", "f"."SendNotifications", "f"."ShowOnMainPage", "f"."SiteUrl", "f"."Status", "f"."StoreLastItems", "f"."SyncEveryMin", "f"."Title"
FROM "News" AS "p"
INNER JOIN "Feed" AS "p.Feed" ON "p"."FeedId" = "p.Feed"."Id"
INNER JOIN "Feed" AS "f" ON "p"."FeedId" = "f"."Id"
WHERE "p.Feed"."ShowOnMainPage" = 1
And one of joins could be removed
the model is:
public class News
{
public string Description { get; set; }
public int FeedId { get; set; }
public string FullText { get; set; }
public string Guid { get; set; }
public int Id { get; set; }
public string Link { get; set; }
public DateTime? PubDate { get; set; }
public DateTime DateAdded { get; set; }
public string Title { get; set; }
public bool IsRead { get; set; }
public bool IsFavourite { get; set; }
public Feed Feed { get; set; }
}
public class Feed
{
public string Description { get; set; }
public string Encoding { get; set; }
public string FeedUrl { get; set; }
public int Id { get; set; }
public string Logo { get; set; }
public string SiteUrl { get; set; }
public FeedStatus Status { get; set; }
public string Title { get; set; }
public int StoreLastItems { get; set; }
public int SyncEveryMin { get; set; }
public bool SendNotifications { get; set; }
public bool IncludeImageInNotification { get; set; }
public List<News> News { get; set; }
}
public class DataContext : DbContext
{
public virtual DbSet Feeds { get; set; }
public virtual DbSet News { get; set; }
Next query
var news = context.News.Include(p => p.Feed).Where(p => p.Feed.ShowOnMainPage).AsNoTracking().ToList();
Generate the following SQL statements.
SELECT "p"."Id", "p"."DateAdded", "p"."Description", "p"."FeedId", "p"."FullText", "p"."Guid", "p"."IsFavourite", "p"."IsRead", "p"."Link", "p"."PubDate", "p"."Title", "f"."Id", "f"."Description", "f"."Encoding", "f"."FeedUrl", "f"."IncludeImageInNotification", "f"."Logo", "f"."SendNotifications", "f"."ShowOnMainPage", "f"."SiteUrl", "f"."Status", "f"."StoreLastItems", "f"."SyncEveryMin", "f"."Title"
FROM "News" AS "p"
INNER JOIN "Feed" AS "p.Feed" ON "p"."FeedId" = "p.Feed"."Id"
INNER JOIN "Feed" AS "f" ON "p"."FeedId" = "f"."Id"
WHERE "p.Feed"."ShowOnMainPage" = 1
And one of joins could be removed
the model is:
public class News
{
public string Description { get; set; }
public int FeedId { get; set; }
public string FullText { get; set; }
public string Guid { get; set; }
public int Id { get; set; }
public string Link { get; set; }
public DateTime? PubDate { get; set; }
public DateTime DateAdded { get; set; }
public string Title { get; set; }
public bool IsRead { get; set; }
public bool IsFavourite { get; set; }
}
public class Feed
{
public string Description { get; set; }
public string Encoding { get; set; }
public string FeedUrl { get; set; }
public int Id { get; set; }
public string Logo { get; set; }
public string SiteUrl { get; set; }
public FeedStatus Status { get; set; }
public string Title { get; set; }
public int StoreLastItems { get; set; }
public int SyncEveryMin { get; set; }
public bool SendNotifications { get; set; }
public bool IncludeImageInNotification { get; set; }
}
public class DataContext : DbContext
{
public virtual DbSet Feeds { get; set; }
public virtual DbSet News { get; set; }
}
Reproduced in EntityFramework.Sqlite 7.0.0-rc1-15948
The text was updated successfully, but these errors were encountered: