mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19342: Using Eq operator when querying a single content type
Work Item: 19342 --HG-- branch : 1.x
This commit is contained in:
@@ -66,7 +66,13 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
private void ForType(params string[] contentTypeNames) {
|
||||
if (contentTypeNames != null && contentTypeNames.Length != 0)
|
||||
BindTypeCriteria().Add(Restrictions.InG("Name", contentTypeNames));
|
||||
// don't use the IN operator if not needed for performance reasons
|
||||
if (contentTypeNames.Length == 1) {
|
||||
BindTypeCriteria().Add(Restrictions.Eq("Name", contentTypeNames[0]));
|
||||
}
|
||||
else {
|
||||
BindTypeCriteria().Add(Restrictions.InG("Name", contentTypeNames));
|
||||
}
|
||||
}
|
||||
|
||||
public void ForVersion(VersionOptions options) {
|
||||
|
Reference in New Issue
Block a user