I see so many threads where people assume the FIND method will return objects with any of the attributes marked as find="true".
Would it be possible to override the Find method and force it to use OR instead of AND?
It just seems like something that would be useful to people.
I realise that a RetriveCriteria will do this, but it is also a little more envolved.
Adam
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As you know, when it comes to software anything is possible :-).
I haven't changed find to be an OR because it will introduce uncertainty into the object retrieval.
A find/retrieve operation is designed to return a single object. Retrieve works via the primary key, and find is designed to work using an alternative unique key (so that key encapsulation via guids/oids is still usable).
If I change Find() to be a partial match instead of a full match, then it is entirely possible that multiple records will be returned. Should this occur, which record do I use to populate the object to be returned? At the moment it would be the first record, but maybe the application is after the last one, or the 14th, or the 3rd, etc. I would have no way of knowing for sure and the programmer would also be unsure as to which object would be retrieved.
It's probably better to create a different method that wraps the RetrieveCriteria into a single line to make coding simpler.
- Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see so many threads where people assume the FIND method will return objects with any of the attributes marked as find="true".
Would it be possible to override the Find method and force it to use OR instead of AND?
It just seems like something that would be useful to people.
I realise that a RetriveCriteria will do this, but it is also a little more envolved.
Adam
Hi Adam,
As you know, when it comes to software anything is possible :-).
I haven't changed find to be an OR because it will introduce uncertainty into the object retrieval.
A find/retrieve operation is designed to return a single object. Retrieve works via the primary key, and find is designed to work using an alternative unique key (so that key encapsulation via guids/oids is still usable).
If I change Find() to be a partial match instead of a full match, then it is entirely possible that multiple records will be returned. Should this occur, which record do I use to populate the object to be returned? At the moment it would be the first record, but maybe the application is after the last one, or the 14th, or the 3rd, etc. I would have no way of knowing for sure and the programmer would also be unsure as to which object would be retrieved.
It's probably better to create a different method that wraps the RetrieveCriteria into a single line to make coding simpler.
- Richard.