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

AsQueryable() with or without in Removing relationships #3166

Closed
PingPongSet opened this issue Mar 20, 2021 · 1 comment · Fixed by #3173
Closed

AsQueryable() with or without in Removing relationships #3166

PingPongSet opened this issue Mar 20, 2021 · 1 comment · Fixed by #3173
Assignees
Milestone

Comments

@PingPongSet
Copy link

The line below without AsQueryable() also works.

            var post = blog.Posts.First();

Is AsQueryable() optonal in the code below?

        #region RemovingRelationships
        using (var context = new BloggingContext())
        {
            var blog = context.Blogs.Include(b => b.Posts).First();
            **var post = blog.Posts.AsQueryable().First();**

            blog.Posts.Remove(post);
            context.SaveChanges();
        }
        #endregion

Document details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@roji roji self-assigned this Mar 23, 2021
@roji roji added this to the 6.0.0 milestone Mar 23, 2021
@roji
Copy link
Member

roji commented Mar 23, 2021

The AsQueryable above doesn't do anything and can be removed - will search and remove these occurrences in the samples.

roji added a commit that referenced this issue Mar 23, 2021
roji added a commit that referenced this issue Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants