FetchNewEntity Behaviour

Posts   
 
    
brettlj
User
Posts: 27
Joined: 08-Feb-2004
# Posted on: 12-Feb-2005 05:17:53   

Hi Frans,

I noticed that DataAccessAdapter's FetchNewEntity method will just return the first entity returned by the query if the RelationPredicateBucket passed into the method doesn't filter the result set down to 1 record.

I was surprised by this--I was expecting it to throw an exception. If I provide a predicate that should only return a single row, and it returns more than that, that is certainly something I want to know about (either by an exception or flag variable). I realize that chaning the behavior now probably isn't possible, but would it be possible to provide a bool parameter to that method to have it throw an exception in this case?

Thanks, Brett

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Feb-2005 14:13:11   

I'll add it to the todo. It will be a bit of a problem though to do it via an overload with a flag, as that will cause for another virtual method and inherited classes then will break (as they overload the wrong method). I think the best way to solve this is via flags in the adapter object itself: set a flag, and the behavior changes.

Frans Bouma | Lead developer LLBLGen Pro