private IQueryable BuildQueryRoot(IEntityType entityType)
 {
     return(entityType.DefiningEntityType is IEntityType definingEntityType
         ? BuildQueryRoot(definingEntityType, entityType, entityType.DefiningNavigationName)
         : entityType.FindOwnership() is IForeignKey ownership
             ? BuildQueryRoot(ownership.PrincipalEntityType, entityType, ownership.PrincipalToDependent.Name)
             : entityType.HasSharedClrType
                 ? (IQueryable)_setCache.GetOrAddSet(_setSource, entityType.Name, entityType.ClrType)
                 : (IQueryable)_setCache.GetOrAddSet(_setSource, entityType.ClrType));
 }
        private IQueryable BuildQueryRoot(IEntityType entityType)
        {
            var definingEntityType = entityType.DefiningEntityType;

            return(definingEntityType == null
                ? (IQueryable)_setCache.GetOrAddSet(_setSource, entityType.ClrType)
                : BuildQueryRoot(definingEntityType, entityType));
        }