Shaving off a few microseconds per content item import.

This commit is contained in:
Sipke Schoorstra
2015-09-07 13:22:01 +01:00
parent 49c772bf25
commit 999a10b6e4

View File

@@ -98,13 +98,14 @@ namespace Orchard.Recipes.Providers.Executors {
var nextIdentity = importContentSession.GetNextInBatch(); var nextIdentity = importContentSession.GetNextInBatch();
while (nextIdentity != null) { while (nextIdentity != null) {
var itemId = ""; var itemId = "";
if (elementDictionary[nextIdentity.ToString()].HasAttributes) { var nextIdentityValue = nextIdentity.ToString();
itemId = elementDictionary[nextIdentity.ToString()].FirstAttribute.Value; if (elementDictionary[nextIdentityValue].HasAttributes) {
itemId = elementDictionary[nextIdentityValue].FirstAttribute.Value;
} }
Logger.Information("Importing data item '{0}' (item {1}/{2}).", itemId, itemIndex + 1, elementDictionary.Count); Logger.Information("Importing data item '{0}' (item {1}/{2}).", itemId, itemIndex + 1, elementDictionary.Count);
try { try {
_orchardServices.ContentManager.Import( _orchardServices.ContentManager.Import(
elementDictionary[nextIdentity.ToString()], elementDictionary[nextIdentityValue],
importContentSession); importContentSession);
} }
catch (Exception ex) { catch (Exception ex) {