-
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
EF.Property
is not working in .Include
. Is it a bug or intended?
#27672
Comments
Note that the version which uses LINQ APIs to get private field works, i.e., var param = Expression.Parameter(typeof(Entity));
var field = typeof(Entity).GetField("_entityVersions", BindingFlags.Instance | BindingFlags.NonPublic)!;
var fieldAccess = Expression.Field(param, field);
var expression = Expression.Lambda<Func<Entity, IList<EntityVersion>>>(fieldAccess, param);
var entities = (
from e in dbContext.Entities
.Include(expression)
select e
).ToArray(); |
@ajcvickers Then, if I want to use |
@paxbun Typically if you are building these includes dynamically, then it is easier to just use strings for the navigations to load. For example, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ask a question
Remember:
Include your code
Usually the best way to ask a clear question and get a quick response is to show your code. Preferably, attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing.
Include stack traces
Include the full exception message and stack trace for any exception you encounter.
Use triple-tick fences for stack traces. For example:
Include verbose output
Please include verbose output when asking questions about the
dotnet ef
or Package Manager Console tools.Include provider and version information
EF Core version: 6.0.1
Database provider: Pomelo.EntityFrameworkCore.MySql 6.0.1
Target framework: .NET 6.0
Operating system: macOS
IDE: Rider 2021.3.3
The text was updated successfully, but these errors were encountered: