Don't throw on private and protected properties

This commit is contained in:
Koen
2023-03-16 00:23:06 +00:00
parent 88cebbcabc
commit 2295e29125
3 changed files with 37 additions and 1 deletions

View File

@@ -89,7 +89,7 @@ namespace EntityFrameworkCore.Projectables.Extensions
public static PropertyInfo GetOverridingProperty(this Type derivedType, PropertyInfo propertyInfo)
{
var accessor = propertyInfo.GetAccessors()[0];
var accessor = propertyInfo.GetAccessors(true)[0];
if (!derivedType.CanHaveOverridingMethod(accessor))
{

View File

@@ -0,0 +1,2 @@
SELECT [e].[Id]
FROM [Entity] AS [e]

View File

@@ -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());
}
}
}