mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-20 10:01:45 +08:00
Prevents to query the database if the requested culture is null or empty
This commit is contained in:
parent
95cd4c0fb5
commit
d18b9e93e9
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@ -87,9 +87,12 @@ namespace Orchard.Localization.Services {
|
||||
});
|
||||
}
|
||||
public CultureRecord GetCultureByName(string cultureName) {
|
||||
if (string.IsNullOrWhiteSpace(cultureName)) {
|
||||
return null;
|
||||
}
|
||||
var cultures = GetAllCulturesByName();
|
||||
CultureRecord result;
|
||||
cultures.TryGetValue(cultureName ?? "", out result);
|
||||
cultures.TryGetValue(cultureName, out result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user