mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-06-01 22:15:11 +00:00
Don't throw on private and protected properties
This commit is contained in:
@@ -89,7 +89,7 @@ namespace EntityFrameworkCore.Projectables.Extensions
|
|||||||
|
|
||||||
public static PropertyInfo GetOverridingProperty(this Type derivedType, PropertyInfo propertyInfo)
|
public static PropertyInfo GetOverridingProperty(this Type derivedType, PropertyInfo propertyInfo)
|
||||||
{
|
{
|
||||||
var accessor = propertyInfo.GetAccessors()[0];
|
var accessor = propertyInfo.GetAccessors(true)[0];
|
||||||
|
|
||||||
if (!derivedType.CanHaveOverridingMethod(accessor))
|
if (!derivedType.CanHaveOverridingMethod(accessor))
|
||||||
{
|
{
|
||||||
|
|||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
SELECT [e].[Id]
|
||||||
|
FROM [Entity] AS [e]
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using VerifyXunit;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace EntityFrameworkCore.Projectables.FunctionalTests
|
||||||
|
{
|
||||||
|
[UsesVerify]
|
||||||
|
public class PrivateProjectables
|
||||||
|
{
|
||||||
|
public record Entity
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsAdmin => true;
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task Issue63Repro()
|
||||||
|
{
|
||||||
|
using var dbContext = new SampleDbContext<Entity>();
|
||||||
|
|
||||||
|
var query = dbContext.Set<Entity>()
|
||||||
|
.Where(product => IsAdmin || product.Id == 1);
|
||||||
|
|
||||||
|
return Verifier.Verify(query.ToQueryString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user