Full exemple in Console application gist
I have some entities with readonly property that is calculated.
This is my Automapper mapping config to calculate the property.
cfg.CreateMap(t, t).ForMember(nameof(ITestInterface.IsReadOnly), opt => opt.MapFrom(src => ((ITestInterface)src).OrganizationUnitId == ((ITestInterface)src).TenantId));
And this is a simple query that throws exception
var simpleQuery = from super in context.SuperEntities.AsQueryable().ProjectTo<SuperEntity>()
join other in context.OtherSuperEntities.AsQueryable().ProjectTo<OtherSuperEntity>() on super.Id equals other.SuperEntityId
select new { super.IsReadOnly, other.OtherSuperDescription };
var simpleResult = simpleQuery.ToList();
I got an InvalidOperationException: An exception occurred while reading a database value for property 'OtherSuperEntity.Id'. The expected type was 'System.Int64' but the actual value was of type 'System.Boolean'.
Is this an issue of automapper? They just closed my issue