The engine emits 'Distinct' into the query if it suspects there are duplicates in the resultset. E.g. select c.* from Customer c inner join Order o ... will result in duplicate customer rows, so it emits distinct. This is an optimization to limit a lot of duplicate rows being fetched as filtering out duplicated entity instances on the client is slow.
There's no API for disabling this behavior as it's in general what you want. Is there a reason the DISTINCT keyword can't be executed (you mention a cache but not why distinct fails).
There's a way to remove it tho, which is to alter the SQL query that's executed. Using Adapter, create a partial class of DataAccessAdapter and add some flag to signal DISTINCT should be removed (so you only remove it in certain queries).
Then override OnFetchEntityCollection(..)
You'll get the IRetrievalQuery passed in as the first argument. In that object, the Command's CommandText can be altered based on e.g. your flag you added, and with a simple string replace you could e.g. replace SELECT DISTINCT
with SELECT
. This is pretty low level but could work in filtering it out in the cases you can't avoid it.