mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 03:58:13 +08:00
Removing FuncDictionary
--HG-- branch : autoroute
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Orchard.ContentManagement {
|
namespace Orchard.ContentManagement {
|
||||||
public class ContentItemMetadata {
|
public class ContentItemMetadata {
|
||||||
@@ -11,7 +11,7 @@ namespace Orchard.ContentManagement {
|
|||||||
}
|
}
|
||||||
public string DisplayText { get; set; }
|
public string DisplayText { get; set; }
|
||||||
public ContentIdentity Identity { get; set; }
|
public ContentIdentity Identity { get; set; }
|
||||||
public RouteValueDictionary DisplayRouteValues { get { return RouteValues.Get("Display"); } set { RouteValues.Set("Display",()=>value); } }
|
public RouteValueDictionary DisplayRouteValues { get; set; }
|
||||||
public RouteValueDictionary EditorRouteValues { get; set; }
|
public RouteValueDictionary EditorRouteValues { get; set; }
|
||||||
public RouteValueDictionary CreateRouteValues { get; set; }
|
public RouteValueDictionary CreateRouteValues { get; set; }
|
||||||
public RouteValueDictionary RemoveRouteValues { get; set; }
|
public RouteValueDictionary RemoveRouteValues { get; set; }
|
||||||
@@ -19,8 +19,9 @@ namespace Orchard.ContentManagement {
|
|||||||
get { return _adminRouteValues ?? EditorRouteValues; }
|
get { return _adminRouteValues ?? EditorRouteValues; }
|
||||||
set { _adminRouteValues = value; }
|
set { _adminRouteValues = value; }
|
||||||
}
|
}
|
||||||
|
public readonly IDictionary<string, Func<RouteValueDictionary>> RouteValues = new Dictionary<string, Func<RouteValueDictionary>>();
|
||||||
|
|
||||||
public readonly IList<GroupInfo> DisplayGroupInfo = new List<GroupInfo>();
|
public readonly IList<GroupInfo> DisplayGroupInfo = new List<GroupInfo>();
|
||||||
public readonly IList<GroupInfo> EditorGroupInfo = new List<GroupInfo>();
|
public readonly IList<GroupInfo> EditorGroupInfo = new List<GroupInfo>();
|
||||||
public readonly FuncDictionary<string, RouteValueDictionary> RouteValues = new FuncDictionary<string, RouteValueDictionary>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Orchard.ContentManagement {
|
|
||||||
public class FuncDictionary<TKey, TVal> {
|
|
||||||
|
|
||||||
private readonly IDictionary<TKey, TVal> _cached;
|
|
||||||
private readonly IDictionary<TKey, Func<TVal>> _factories;
|
|
||||||
|
|
||||||
public FuncDictionary() {
|
|
||||||
_cached = new Dictionary<TKey, TVal>();
|
|
||||||
_factories = new Dictionary<TKey, Func<TVal>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TVal Get(TKey key) {
|
|
||||||
if (!_cached.ContainsKey(key)) {
|
|
||||||
if (!_factories.ContainsKey(key)) return default(TVal);
|
|
||||||
_cached[key] = _factories[key]();
|
|
||||||
}
|
|
||||||
return _cached[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Set(TKey key, Func<TVal> factory) {
|
|
||||||
_cached.Remove(key);
|
|
||||||
_factories[key] = factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Remove(TKey key) {
|
|
||||||
_cached.Remove(key);
|
|
||||||
_factories.Remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -165,7 +165,6 @@
|
|||||||
<Compile Include="ContentManagement\ContentItemBehavior.cs" />
|
<Compile Include="ContentManagement\ContentItemBehavior.cs" />
|
||||||
<Compile Include="ContentManagement\ContentPartBehavior.cs" />
|
<Compile Include="ContentManagement\ContentPartBehavior.cs" />
|
||||||
<Compile Include="ContentManagement\DefaultHqlQuery.cs" />
|
<Compile Include="ContentManagement\DefaultHqlQuery.cs" />
|
||||||
<Compile Include="ContentManagement\FuncDictionary.cs" />
|
|
||||||
<Compile Include="ContentManagement\Handlers\UpdateContentContext.cs" />
|
<Compile Include="ContentManagement\Handlers\UpdateContentContext.cs" />
|
||||||
<Compile Include="ContentManagement\IHqlExpression.cs" />
|
<Compile Include="ContentManagement\IHqlExpression.cs" />
|
||||||
<Compile Include="ContentManagement\IHqlQuery.cs" />
|
<Compile Include="ContentManagement\IHqlQuery.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user