-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include with Join stopped working on preview9 #17664
Comments
I am not able to reproduce this. using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace EFSampleApp
{
public class Program
{
public static void Main(string[] args)
{
using (var db = new MyContext())
{
// Recreate database
db.Database.EnsureDeleted();
db.Database.EnsureCreated();
// Seed database
db.Add(new Blog
{
BlogDetails = new BlogDetails { Value = "BlogDetails" },
Title = "FirstBlog"
});
db.Add(new Author { Name = "First" });
db.SaveChanges();
}
using (var db = new MyContext())
{
// Run queries
var query = db.Blogs.Include(b => b.BlogDetails)
.Join(db.Authors, l => l.Id, r => r.Id, (l, r) => new { l, r })
.ToList();
Console.WriteLine(query[0].l.Title);
Console.WriteLine(query[0].l.BlogDetails.Value);
Console.WriteLine(query[0].r.Name);
}
Console.WriteLine("Program finished.");
}
}
public class MyContext : DbContext
{
private static ILoggerFactory ContextLoggerFactory
=> LoggerFactory.Create(b =>
{
b
.AddConsole()
.AddFilter("", LogLevel.Debug);
});
// Declare DBSets
public DbSet<Blog> Blogs { get; set; }
public DbSet<Author> Authors { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// Select 1 provider
optionsBuilder
.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=_ModelApp;Trusted_Connection=True;Connect Timeout=5;ConnectRetryCount=0")
//.UseSqlite("filename=_modelApp.db")
//.UseInMemoryDatabase(databaseName: "_modelApp")
//.UseCosmos("https://localhost:8081", @"C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==", "_ModelApp")
//.EnableSensitiveDataLogging()
//.UseLoggerFactory(ContextLoggerFactory)
;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// Configure model
}
}
public class Blog
{
public int Id { get; set; }
public string Title { get; set; }
public BlogDetails BlogDetails { get; set; }
}
public class BlogDetails
{
public int Id { get; set; }
public string Value { get; set; }
}
public class Author
{
public int Id { get; set; }
public string Name { get; set; }
}
} Output
Please post a runnable project (or modify above repro code) to demonstrate the issue you are seeing. |
CosmosDb does not support join on server side. Hence EF Core cannot translate it to server. |
@AndriySvyryd to find the duplicate. |
Duplicate of #16920 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Having a query like this:
The Property "NavigationProperty" is null. This is working on preview8.
Steps to reproduce
Having three entities with a NavigationProperty. Join a query with Includes.
Further technical details
EF Core version: 3.0.0-preview9.19423.6
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2019 16.3.0 preview 3.0
The text was updated successfully, but these errors were encountered: