mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Moving ImportContentSession to a separate file.
--HG-- branch : dev
This commit is contained in:
@@ -466,39 +466,6 @@ namespace Orchard.ContentManagement {
|
||||
}
|
||||
}
|
||||
|
||||
public class ImportContentSession {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
// order of x500 elements.
|
||||
private readonly Dictionary<string, ContentItem> _dictionary;
|
||||
|
||||
public ImportContentSession(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
_dictionary = new Dictionary<string, ContentItem>();
|
||||
}
|
||||
|
||||
// gets a content item for an identity string.
|
||||
public ContentItem Get(string id) {
|
||||
if (_dictionary.ContainsKey(id))
|
||||
return _dictionary[id];
|
||||
|
||||
foreach (var item in _contentManager.Query(VersionOptions.Published).List()) {
|
||||
var identity = _contentManager.GetItemMetadata(item).Identity.ToString();
|
||||
if (identity == id) {
|
||||
_dictionary.Add(identity, item);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Store(string id, ContentItem item) {
|
||||
_dictionary.Add(id, item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CallSiteCollection : ConcurrentDictionary<string, CallSite<Func<CallSite, object, object>>> {
|
||||
readonly Func<string, CallSite<Func<CallSite, object, object>>> _valueFactory;
|
||||
|
||||
|
||||
36
src/Orchard/ContentManagement/ImportContentSession.cs
Normal file
36
src/Orchard/ContentManagement/ImportContentSession.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.ContentManagement {
|
||||
public class ImportContentSession {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
// order of x500 elements.
|
||||
private readonly Dictionary<string, ContentItem> _dictionary;
|
||||
|
||||
public ImportContentSession(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
_dictionary = new Dictionary<string, ContentItem>();
|
||||
}
|
||||
|
||||
// gets a content item for an identity string.
|
||||
public ContentItem Get(string id) {
|
||||
if (_dictionary.ContainsKey(id))
|
||||
return _dictionary[id];
|
||||
|
||||
foreach (var item in _contentManager.Query(VersionOptions.Published).List()) {
|
||||
var identity = _contentManager.GetItemMetadata(item).Identity.ToString();
|
||||
if (identity == id) {
|
||||
_dictionary.Add(identity, item);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Store(string id, ContentItem item) {
|
||||
_dictionary.Add(id, item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -160,6 +160,7 @@
|
||||
<Compile Include="ContentManagement\Handlers\ExportContentContext.cs" />
|
||||
<Compile Include="ContentManagement\Handlers\ImportContentContext.cs" />
|
||||
<Compile Include="ContentManagement\IContentBehavior.cs" />
|
||||
<Compile Include="ContentManagement\ImportContentSession.cs" />
|
||||
<Compile Include="ContentManagement\Utilities\ComputedField.cs" />
|
||||
<Compile Include="DisplayManagement\Descriptors\PlacementInfo.cs" />
|
||||
<Compile Include="DisplayManagement\Descriptors\ResourceBindingStrategy\StylesheetBindingStrategy.cs" />
|
||||
|
||||
Reference in New Issue
Block a user