Skip to content
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

Query: LoadAsync does not work #6122

Closed
ajcvickers opened this issue Jul 21, 2016 · 1 comment
Closed

Query: LoadAsync does not work #6122

ajcvickers opened this issue Jul 21, 2016 · 1 comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@ajcvickers
Copy link
Contributor

No entities end up being tracked.
Repro:

public class BloggingContext : DbContext
{
    public DbSet<Blog> Blogs { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        => optionsBuilder.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=LoadAsyncTest;Trusted_Connection=True;");
}

public class Blog
{
    public int Id { get; set; }
    public string Title { get; set; }
}

public class Program
{
    public static void Main()
    {
        Task.Run(async () =>
        {
            await MainAsync();
        }).Wait();
    }

    public static async Task MainAsync()
    {
        using (var context = new BloggingContext())
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            context.AddRange(new Blog(), new Blog());
            await context.SaveChangesAsync();
        }

        using (var context = new BloggingContext())
        {
            await context.Blogs.LoadAsync();

            Console.WriteLine(context.ChangeTracker.Entries().Count());
        }
    }
}

Output is 0; expected output is 2.
When run with Load instead of LoadAsync, output is 2 as expected.

Note that there are currently zero tests for LoadAsync.

@ajcvickers
Copy link
Contributor Author

Note that the LoadAsync code in EntityFinder should be updated when this bug is fixed.

@rowanmiller rowanmiller added this to the 1.0.1 milestone Jul 25, 2016
@rowanmiller rowanmiller changed the title LoadAsync does not work Query: LoadAsync does not work Jul 26, 2016
@anpete anpete closed this as completed in 3c285ce Jul 26, 2016
@divega divega added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Sep 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants