I tried to customize the queries executed by Orchard.ContentManagement.DefaultContentManager
but the following peace of code *1
render my efforts useless:
class DefaultContentManager
{
...
public virtual ContentItem Get(int id, VersionOptions options, QueryHints hints) {
...
// implemention of the query comes here
...
*1 -> // no record means content item is not in db
if (versionRecord == null) {
// check in memory
var record = _contentItemRepository.Get(id);
if (record == null) {
return null;
}
versionRecord = GetVersionRecord(options, record);
if (versionRecord == null) {
return null;
}
}
The query is executed correctly and it does not return any data (which was my goal) but afterwards a second attempt *1
is executed to still get the content item.
Why is this part of code there? What is its purpose? Also why does the comment state check in memory
and then the repository (DB table) is queried.