Skip to content

Commit

Permalink
Small fix to IInjectableService and lazy loading that removes constan…
Browse files Browse the repository at this point in the history
…ts of ParameterBindingInfo objects. This is needed for precompiled query work (#33534)
  • Loading branch information
maumar committed Apr 15, 2024
1 parent f0e88d4 commit 2b6ba12
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/EFCore/Infrastructure/Internal/LazyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public class LazyLoader : ILazyLoader, IInjectableService
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual void Injected(DbContext context, object entity, ParameterBindingInfo bindingInfo)
public virtual void Injected(DbContext context, object entity, QueryTrackingBehavior? queryTrackingBehavior, ITypeBase structuralType)
{
_queryTrackingBehavior = bindingInfo.QueryTrackingBehavior;
_nonLazyNavigations ??= InitNavigationsMetadata(bindingInfo.StructuralType as IEntityType
_queryTrackingBehavior = queryTrackingBehavior;
_nonLazyNavigations ??= InitNavigationsMetadata(structuralType as IEntityType
?? throw new NotImplementedException("Navigations on complex types are not supported"));
}

Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/Internal/IInjectableService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface IInjectableService
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
void Injected(DbContext context, object entity, ParameterBindingInfo bindingInfo);
void Injected(DbContext context, object entity, QueryTrackingBehavior? queryTrackingBehavior, ITypeBase structuralType);

/// <summary>
/// <para>
Expand Down
3 changes: 2 additions & 1 deletion src/EFCore/Query/Internal/EntityMaterializerSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ public static IList<T> PopulateList<T>(IEnumerable<T> buffer, IList<T> target)
InjectableServiceInjectedMethod,
getContext,
instanceVariable,
Expression.Constant(bindingInfo, typeof(ParameterBindingInfo)))));
Expression.Constant(bindingInfo.QueryTrackingBehavior, typeof(QueryTrackingBehavior?)),
Expression.Constant(bindingInfo.StructuralType))));
}
}

Expand Down

0 comments on commit 2b6ba12

Please sign in to comment.