diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedFragment.cs b/src/Umbraco.Core/Models/PublishedContent/IPropertySet.cs
similarity index 90%
rename from src/Umbraco.Core/Models/PublishedContent/IPublishedFragment.cs
rename to src/Umbraco.Core/Models/PublishedContent/IPropertySet.cs
index eed11af3a5..c2cf806c0b 100644
--- a/src/Umbraco.Core/Models/PublishedContent/IPublishedFragment.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/IPropertySet.cs
@@ -4,9 +4,9 @@ using System.Collections.Generic;
namespace Umbraco.Core.Models.PublishedContent
{
///
- /// Represents a facade fragment.
+ /// Represents a facade property set.
///
- public interface IPublishedFragment
+ public interface IPropertySet
{
#region ContentType
@@ -17,7 +17,7 @@ namespace Umbraco.Core.Models.PublishedContent
#endregion
- #region Content
+ #region PropertySet
///
/// Gets the unique key of the facade item.
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Models.PublishedContent
#region Properties
///
- /// Gets the properties of the content.
+ /// Gets the properties of the set.
///
/// Contains one IPublishedProperty for each property defined for the content type, including
/// inherited properties. Some properties may have no value.
diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
index 8f47922d07..46f1aaf05e 100644
--- a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Models.PublishedContent
/// cached preview (so, maybe unpublished) content. A better name would therefore be ICachedContent, as
/// has been suggested. However, can't change now. Maybe in v7?
///
- public interface IPublishedContent : IPublishedFragment
+ public interface IPublishedContent : IPropertySet
{
#region Content
diff --git a/src/Umbraco.Core/Models/PublishedContent/NoopPublishedContentModelFactory.cs b/src/Umbraco.Core/Models/PublishedContent/NoopPublishedContentModelFactory.cs
index 9fbcadb29b..965c01aae3 100644
--- a/src/Umbraco.Core/Models/PublishedContent/NoopPublishedContentModelFactory.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/NoopPublishedContentModelFactory.cs
@@ -7,7 +7,7 @@
return content;
}
- public T CreateModel(IPublishedFragment content)
+ public T CreateModel(IPropertySet content)
{
throw new System.NotImplementedException();
}
diff --git a/src/Umbraco.Core/Models/PublishedContent/PropertySetModel.cs b/src/Umbraco.Core/Models/PublishedContent/PropertySetModel.cs
new file mode 100644
index 0000000000..ee087128ff
--- /dev/null
+++ b/src/Umbraco.Core/Models/PublishedContent/PropertySetModel.cs
@@ -0,0 +1,19 @@
+namespace Umbraco.Core.Models.PublishedContent
+{
+ ///
+ /// Represents a strongly-typed property set.
+ ///
+ /// Every strongly-typed property set class should inherit from PropertySetModel
+ /// (or inherit from a class that inherits from... etc.) so they are picked by the factory.
+ public class PropertySetModel : PropertySetWrapped
+ {
+ ///
+ /// Initializes a new instance of the class with
+ /// an original instance.
+ ///
+ /// The original content.
+ protected PropertySetModel(IPropertySet content)
+ : base(content)
+ { }
+ }
+}
diff --git a/src/Umbraco.Core/Models/PublishedContent/PropertySetWrapped.cs b/src/Umbraco.Core/Models/PublishedContent/PropertySetWrapped.cs
new file mode 100644
index 0000000000..6330093e72
--- /dev/null
+++ b/src/Umbraco.Core/Models/PublishedContent/PropertySetWrapped.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+
+namespace Umbraco.Core.Models.PublishedContent
+{
+ ///
+ /// Provides an abstract base class for IPropertySet implementations that
+ /// wrap and extend another IPropertySet.
+ ///
+ public abstract class PropertySetWrapped : IPropertySet
+ {
+ protected readonly IPropertySet Content;
+
+ ///
+ /// Initializes a new instance of the class
+ /// with an IPropertySet instance to wrap.
+ ///
+ /// The content to wrap.
+ protected PropertySetWrapped(IPropertySet content)
+ {
+ Content = content;
+ }
+
+ ///
+ /// Gets the wrapped content.
+ ///
+ /// The wrapped content, that was passed as an argument to the constructor.
+ public IPropertySet Unwrap() => Content;
+
+ ///
+ public PublishedContentType ContentType => Content.ContentType;
+
+ ///
+ public Guid Key => Content.Key;
+
+ ///
+ public IEnumerable Properties => Content.Properties;
+
+ ///
+ public IPublishedProperty GetProperty(string alias) => Content.GetProperty(alias);
+ }
+}
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs
deleted file mode 100644
index f5b9d07ebb..0000000000
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Linq;
-
-namespace Umbraco.Core.Models.PublishedContent
-{
- [TypeConverter(typeof(PublishedContentTypeConverter))]
- public class PublishedContentExtended : PublishedContentWrapped, IPublishedContentExtended
- {
- #region Constructor
-
- // protected for models, private for our static Extend method
- protected PublishedContentExtended(IPublishedContent content)
- : base(content)
- { }
-
- #endregion
-
- #region Extend
-
- private static IPublishedContent Unwrap(IPublishedContent content)
- {
- if (content == null) return null;
-
- while (true)
- {
- var extended = content as PublishedContentExtended;
- if (extended != null)
- {
- if (((IPublishedContentExtended)extended).HasAddedProperties) return extended;
- content = extended.Unwrap();
- continue;
- }
- var wrapped = content as PublishedContentWrapped;
- if (wrapped != null)
- {
- content = wrapped.Unwrap();
- continue;
- }
- return content;
- }
- }
-
- internal static IPublishedContentExtended Extend(IPublishedContent content)
- {
- // first unwrap content down to the lowest possible level, ie either the deepest inner
- // IPublishedContent or the first extended that has added properties. this is to avoid
- // nesting extended objects as much as possible, so we try to re-extend that lowest
- // object. Then extend. But do NOT create a model, else we would not be able to add
- // properties. BEWARE means that whatever calls Extend MUST create the model.
-
- return new PublishedContentExtended(Unwrap(content));
- }
-
- #endregion
-
- #region IPublishedContentExtended
-
- void IPublishedContentExtended.AddProperty(IPublishedProperty property)
- {
- if (_properties == null)
- _properties = new Collection();
- _properties.Add(property);
- }
-
- bool IPublishedContentExtended.HasAddedProperties => _properties != null;
-
- #endregion
-
- #region Properties
-
- private ICollection _properties;
-
- public override IEnumerable Properties => _properties == null
- ? Content.Properties
- : Content.Properties.Union(_properties).ToList();
-
- public override IPublishedProperty GetProperty(string alias)
- {
- return _properties == null
- ? Content.GetProperty(alias)
- : _properties.FirstOrDefault(prop => prop.PropertyTypeAlias.InvariantEquals(alias)) ?? Content.GetProperty(alias);
- }
-
- #endregion
-
- public override string ToString()
- {
- return Id.ToString();
- }
- }
-}
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactory.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactory.cs
index c43e49e473..d2c5507fc8 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactory.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactory.cs
@@ -82,7 +82,7 @@ namespace Umbraco.Core.Models.PublishedContent
: content;
}
- public T CreateModel(IPublishedFragment content)
+ public T CreateModel(IPropertySet content)
{
throw new NotImplementedException();
}
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
index 585a2f4353..e8d879769f 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
@@ -4,9 +4,7 @@ using System.Collections.Generic;
namespace Umbraco.Core.Models.PublishedContent
{
//
- // This class has two purposes.
- //
- // - First, we cannot implement strongly-typed content by inheriting from some sort
+ // we cannot implement strongly-typed content by inheriting from some sort
// of "master content" because that master content depends on the actual content cache
// that is being used. It can be an XmlPublishedContent with the XmlPublishedCache,
// or just anything else.
@@ -15,11 +13,6 @@ namespace Umbraco.Core.Models.PublishedContent
// returned by the content cache, and providing extra properties (mostly) or
// methods or whatever. This class provides the base for such encapsulation.
//
- // - Second, any time a content is used in a content set obtained from
- // IEnumerable.ToContentSet(), it needs to be cloned and extended
- // in order to know about its position in the set. This class provides the base
- // for implementing such extension.
- //
///
/// Provides an abstract base class for IPublishedContent implementations that
@@ -31,9 +24,9 @@ namespace Umbraco.Core.Models.PublishedContent
///
/// Initialize a new instance of the class
- /// with an IPublishedContent instance to wrap and extend.
+ /// with an IPublishedContent instance to wrap.
///
- /// The content to wrap and extend.
+ /// The content to wrap.
protected PublishedContentWrapped(IPublishedContent content)
{
Content = content;
@@ -43,10 +36,7 @@ namespace Umbraco.Core.Models.PublishedContent
/// Gets the wrapped content.
///
/// The wrapped content, that was passed as an argument to the constructor.
- public IPublishedContent Unwrap()
- {
- return Content;
- }
+ public IPublishedContent Unwrap() => Content;
#region ContentType
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedSearchResult.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedSearchResult.cs
new file mode 100644
index 0000000000..6d30334415
--- /dev/null
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedSearchResult.cs
@@ -0,0 +1,14 @@
+namespace Umbraco.Core.Models.PublishedContent
+{
+ public class PublishedSearchResult
+ {
+ public PublishedSearchResult(IPublishedContent content, float score)
+ {
+ Content = content;
+ Score = score;
+ }
+
+ public IPublishedContent Content { get; }
+ public float Score { get; }
+ }
+}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 78ddc5d584..cea1d42e81 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -607,13 +607,14 @@
-
+
+
+
-
@@ -624,6 +625,7 @@
+
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
index e7ade8dfd3..a9fbbc0749 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
@@ -556,7 +556,7 @@ namespace Umbraco.Tests.PublishedContent
{
var pt = new PublishedPropertyType("detached", Constants.PropertyEditors.IntegerAlias);
var ct = new PublishedContentType(0, "alias", new[] { pt });
- var prop = new PublishedFragmentProperty(pt, Guid.NewGuid(), false, PropertyCacheLevel.None, 5548);
+ var prop = new PropertySetProperty(pt, Guid.NewGuid(), false, PropertyCacheLevel.None, 5548);
Assert.IsInstanceOf(prop.Value);
Assert.AreEqual(5548, prop.Value);
}
@@ -565,7 +565,7 @@ namespace Umbraco.Tests.PublishedContent
{
var type = ContentTypesCache.Get(PublishedItemType.Content, "detachedSomething");
var values = new Dictionary();
- var f = new PublishedFragment(type, Guid.NewGuid(), values, false);
+ var f = new PropertySet(type, Guid.NewGuid(), values, false);
}
[Test]
@@ -593,7 +593,7 @@ namespace Umbraco.Tests.PublishedContent
Assert.AreEqual(val3, c.Size);
}
- class ImageWithLegendModel : PublishedFragment
+ class ImageWithLegendModel : PropertySet
{
public ImageWithLegendModel(PublishedContentType contentType, Guid fragmentKey, Dictionary values, bool previewing)
: base(contentType, fragmentKey, values, previewing)
diff --git a/src/Umbraco.Web/ExamineExtensions.cs b/src/Umbraco.Web/ExamineExtensions.cs
index 97d29bf520..455a857879 100644
--- a/src/Umbraco.Web/ExamineExtensions.cs
+++ b/src/Umbraco.Web/ExamineExtensions.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Examine;
+using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.PublishedCache;
@@ -11,34 +12,16 @@ namespace Umbraco.Web
///
public static class ExamineExtensions
{
- public static IEnumerable ConvertSearchResultToPublishedContent(this IEnumerable results, IPublishedCache cache)
+ public static IEnumerable ToPublishedSearchResults(this IEnumerable results, IPublishedCache cache)
{
- // no need to think about creating the IPublishedContent from the Examine result
- // content cache is fast and optimized - use it!
-
- var list = new List();
+ var list = new List();
foreach (var result in results.OrderByDescending(x => x.Score))
{
var content = cache.GetById(result.Id);
if (content == null) continue; // skip if this doesn't exist in the cache
- // need to extend the content as we're going to add a property to it,
- // and we should not ever do it to the content we get from the cache,
- // precisely because it is cached and shared by all requests.
-
- // but we cannot wrap it because we need to respect the type that was
- // returned by the cache, in case the cache can create real types.
- // so we have to ask it to please extend itself.
-
- var extend = PublishedContentExtended.Extend(content);
- list.Add(extend.CreateModel()); // take care, must create the model!
-
- var property = new PropertyResult("examineScore",
- result.Score,
- PropertyResultType.CustomProperty);
-
- extend.AddProperty(property);
+ list.Add(new PublishedSearchResult(content, result.Score));
}
return list;
diff --git a/src/Umbraco.Web/IPublishedContentQuery.cs b/src/Umbraco.Web/IPublishedContentQuery.cs
index 0ba3da6c4f..2358f0cf40 100644
--- a/src/Umbraco.Web/IPublishedContentQuery.cs
+++ b/src/Umbraco.Web/IPublishedContentQuery.cs
@@ -33,7 +33,7 @@ namespace Umbraco.Web
///
///
///
- IEnumerable Search(string term, bool useWildCards = true, string searchProvider = null);
+ IEnumerable Search(string term, bool useWildCards = true, string searchProvider = null);
///
/// Searhes content
@@ -41,6 +41,6 @@ namespace Umbraco.Web
///
///
///
- IEnumerable Search(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null);
+ IEnumerable Search(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null);
}
}
diff --git a/src/Umbraco.Web/PublishedFragmentExtensions.cs b/src/Umbraco.Web/PropertySetExtensions.cs
similarity index 90%
rename from src/Umbraco.Web/PublishedFragmentExtensions.cs
rename to src/Umbraco.Web/PropertySetExtensions.cs
index 5d2b143f70..cceb3fba55 100644
--- a/src/Umbraco.Web/PublishedFragmentExtensions.cs
+++ b/src/Umbraco.Web/PropertySetExtensions.cs
@@ -9,7 +9,7 @@ namespace Umbraco.Web
///
/// Provides extension methods for IPublishedItem.
///
- public static class PublishedFragmentExtensions
+ public static class PropertySetExtensions
{
#region IsComposedOf
@@ -19,7 +19,7 @@ namespace Umbraco.Web
/// The content.
/// The content type alias.
/// A value indicating whether the content is of a content type composed of a content type identified by the alias.
- public static bool IsComposedOf(this IPublishedFragment content, string alias)
+ public static bool IsComposedOf(this IPropertySet content, string alias)
{
return content.ContentType.CompositionAliases.Contains(alias);
}
@@ -35,7 +35,7 @@ namespace Umbraco.Web
/// The property alias.
/// A value indicating whether the content has the property identified by the alias.
/// The content may have a property, and that property may not have a value.
- public static bool HasProperty(this IPublishedFragment content, string alias)
+ public static bool HasProperty(this IPropertySet content, string alias)
{
return content.ContentType.GetPropertyType(alias) != null;
}
@@ -51,7 +51,7 @@ namespace Umbraco.Web
/// The property alias.
/// A value indicating whether the content has a value for the property identified by the alias.
/// Returns true if GetProperty(alias) is not null and GetProperty(alias).HasValue is true.
- public static bool HasValue(this IPublishedFragment content, string alias)
+ public static bool HasValue(this IPropertySet content, string alias)
{
var prop = content.GetProperty(alias);
return prop != null && prop.HasValue;
@@ -66,7 +66,7 @@ namespace Umbraco.Web
/// The value to return if the content has no value for the property.
/// Either or depending on whether the content
/// has a value for the property identified by the alias.
- public static IHtmlString HasValue(this IPublishedFragment content, string alias,
+ public static IHtmlString HasValue(this IPropertySet content, string alias,
string valueIfTrue, string valueIfFalse = null)
{
return content.HasValue(alias)
@@ -90,7 +90,7 @@ namespace Umbraco.Web
/// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter.
/// The alias is case-insensitive.
///
- public static object Value(this IPublishedFragment content, string alias)
+ public static object Value(this IPropertySet content, string alias)
{
var property = content.GetProperty(alias);
return property?.Value;
@@ -109,7 +109,7 @@ namespace Umbraco.Web
/// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter.
/// The alias is case-insensitive.
///
- public static object Value(this IPublishedFragment content, string alias, string defaultValue)
+ public static object Value(this IPropertySet content, string alias, string defaultValue) // fixme - kill
{
var property = content.GetProperty(alias);
return property == null || property.HasValue == false ? defaultValue : property.Value;
@@ -128,7 +128,7 @@ namespace Umbraco.Web
/// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter.
/// The alias is case-insensitive.
///
- public static object Value(this IPublishedFragment content, string alias, object defaultValue)
+ public static object Value(this IPropertySet content, string alias, object defaultValue)
{
var property = content.GetProperty(alias);
return property == null || property.HasValue == false ? defaultValue : property.Value;
@@ -151,7 +151,7 @@ namespace Umbraco.Web
/// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter.
/// The alias is case-insensitive.
///
- public static T Value(this IPublishedFragment content, string alias)
+ public static T Value(this IPropertySet content, string alias)
{
return content.Value(alias, false, default(T));
}
@@ -170,12 +170,12 @@ namespace Umbraco.Web
/// If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter.
/// The alias is case-insensitive.
///
- public static T Value(this IPublishedFragment content, string alias, T defaultValue)
+ public static T Value(this IPropertySet content, string alias, T defaultValue)
{
return content.Value(alias, true, defaultValue);
}
- internal static T Value(this IPublishedFragment content, string alias, bool withDefaultValue, T defaultValue)
+ internal static T Value(this IPropertySet content, string alias, bool withDefaultValue, T defaultValue) // fixme uh?
{
var property = content.GetProperty(alias);
if (property == null) return defaultValue;
@@ -205,7 +205,7 @@ namespace Umbraco.Web
// TODO: strongly typed properties howto?
// there is no strongly typed recurse, etc => needs to be in ModelsBuilder?
- public static IHtmlString Value(this IPublishedFragment content, string aliases, Func format, string alt = "")
+ public static IHtmlString Value(this IPropertySet content, string aliases, Func format, string alt = "")
{
if (format == null) format = x => x.ToString();
@@ -239,7 +239,7 @@ namespace Umbraco.Web
#region ToIndexedArray
public static IndexedArrayItem[] ToIndexedArray(this IEnumerable source)
- where TContent : class, IPublishedFragment
+ where TContent : class, IPropertySet
{
var set = source.Select((content, index) => new IndexedArrayItem(content, index)).ToArray();
foreach (var setItem in set) setItem.TotalCount = set.Length;
@@ -253,7 +253,7 @@ namespace Umbraco.Web
// the .OfType() filter is nice when there's only one type
// this is to support filtering with multiple types
public static IEnumerable OfTypes(this IEnumerable contents, params string[] types)
- where T : IPublishedFragment
+ where T : IPropertySet
{
types = types.Select(x => x.ToLowerInvariant()).ToArray();
return contents.Where(x => types.Contains(x.ContentType.Alias.ToLowerInvariant()));
diff --git a/src/Umbraco.Web/PublishedCache/FacadeServiceBase.cs b/src/Umbraco.Web/PublishedCache/FacadeServiceBase.cs
index a52883049f..17e3080edf 100644
--- a/src/Umbraco.Web/PublishedCache/FacadeServiceBase.cs
+++ b/src/Umbraco.Web/PublishedCache/FacadeServiceBase.cs
@@ -24,7 +24,12 @@ namespace Umbraco.Web.PublishedCache
public abstract bool EnsureEnvironment(out IEnumerable errors);
- public abstract IPublishedProperty CreateFragmentProperty(PublishedPropertyType propertyType, Guid itemKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null);
+ public virtual IPropertySet CreateSet(PublishedContentType contentType, Guid key, Dictionary values, bool previewing, PropertyCacheLevel referenceCacheLevel)
+ {
+ return new PropertySet(contentType, key, values, previewing, this, referenceCacheLevel);
+ }
+
+ public abstract IPublishedProperty CreateSetProperty(PublishedPropertyType propertyType, Guid setKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null);
public abstract string EnterPreview(IUser user, int contentId);
public abstract void RefreshPreview(string previewToken, int contentId);
diff --git a/src/Umbraco.Web/PublishedCache/IFacadeService.cs b/src/Umbraco.Web/PublishedCache/IFacadeService.cs
index 1154ffbee6..b5ec511fc0 100644
--- a/src/Umbraco.Web/PublishedCache/IFacadeService.cs
+++ b/src/Umbraco.Web/PublishedCache/IFacadeService.cs
@@ -152,18 +152,29 @@ namespace Umbraco.Web.PublishedCache
#endregion
- #region Fragment
+ #region Property Set
///
- /// Creates a fragment property.
+ /// Creates a property set.
+ ///
+ /// The content type.
+ /// The set key.
+ /// Raw values for properties.
+ /// A value indicating whether previewing.
+ /// The reference cache level.
+ /// A property set.
+ IPropertySet CreateSet(PublishedContentType contentType, Guid key, Dictionary values, bool previewing, PropertyCacheLevel referenceCacheLevel);
+
+ ///
+ /// Creates a set property.
///
/// The property type.
- /// The fragment key.
+ /// The set key.
/// A value indicating whether previewing.
/// The reference cache level.
/// The source value.
- /// A fragment property.
- IPublishedProperty CreateFragmentProperty(PublishedPropertyType propertyType, Guid itemKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null);
+ /// A set property.
+ IPublishedProperty CreateSetProperty(PublishedPropertyType propertyType, Guid setKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null);
#endregion
}
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs b/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs
index fc8540baed..0ae481c0a3 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/FacadeService.cs
@@ -1534,11 +1534,11 @@ AND cmsContentNu.nodeId IS NULL
#endregion
- #region Fragments
+ #region Property Set
- public override IPublishedProperty CreateFragmentProperty(PublishedPropertyType propertyType, Guid itemKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
+ public override IPublishedProperty CreateSetProperty(PublishedPropertyType propertyType, Guid setKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
{
- return new PublishedFragmentProperty(FacadeAccessor, propertyType, itemKey, previewing, referenceCacheLevel, sourceValue);
+ return new PropertySetProperty(FacadeAccessor, propertyType, setKey, previewing, referenceCacheLevel, sourceValue);
}
#endregion
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedFragmentProperty.cs b/src/Umbraco.Web/PublishedCache/NuCache/PropertySetProperty.cs
similarity index 87%
rename from src/Umbraco.Web/PublishedCache/NuCache/PublishedFragmentProperty.cs
rename to src/Umbraco.Web/PublishedCache/NuCache/PropertySetProperty.cs
index 4e235c31a2..cc4e9eaa90 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedFragmentProperty.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PropertySetProperty.cs
@@ -5,13 +5,13 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PublishedCache.NuCache
{
- internal class PublishedFragmentProperty : PublishedFragmentPropertyBase
+ internal class PropertySetProperty : PropertySetPropertyBase
{
private readonly IFacadeAccessor _facadeAccessor;
private string _valuesCacheKey;
// initializes a published item property
- public PublishedFragmentProperty(IFacadeAccessor facadeAccessor, PublishedPropertyType propertyType, Guid fragmentKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
+ public PropertySetProperty(IFacadeAccessor facadeAccessor, PublishedPropertyType propertyType, Guid fragmentKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
: base(propertyType, fragmentKey, previewing, referenceCacheLevel, sourceValue)
{
_facadeAccessor = facadeAccessor;
diff --git a/src/Umbraco.Web/PublishedCache/PublishedFragment.cs b/src/Umbraco.Web/PublishedCache/PropertySet.cs
similarity index 64%
rename from src/Umbraco.Web/PublishedCache/PublishedFragment.cs
rename to src/Umbraco.Web/PublishedCache/PropertySet.cs
index ebd76f3b20..98cd39c978 100644
--- a/src/Umbraco.Web/PublishedCache/PublishedFragment.cs
+++ b/src/Umbraco.Web/PublishedCache/PropertySet.cs
@@ -7,21 +7,19 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PublishedCache
{
// notes:
- // a published fragment does NOT manage any tree-like elements, neither the
+ // a property set does NOT manage any tree-like elements, neither the
// original NestedContent (from Lee) nor the DetachedPublishedContent POC did.
//
- // at the moment we do NOT support models for fragments - that would require
+ // at the moment we do NOT support models for sets - that would require
// an entirely new models factory + not even sure it makes sense at all since
- // fragments are created manually
+ // sets are created manually
//
- internal class PublishedFragment : IPublishedFragment
+ internal class PropertySet : IPropertySet
{
- // initializes a new instance of the PublishedFragment class
+ // initializes a new instance of the PropertySet class
// within the context of a facade service (eg a published content property value)
- public PublishedFragment(PublishedContentType contentType,
- IFacadeService facadeService, PropertyCacheLevel referenceCacheLevel,
- Guid key, Dictionary values,
- bool previewing)
+ public PropertySet(PublishedContentType contentType, Guid key, Dictionary values, bool previewing,
+ IFacadeService facadeService, PropertyCacheLevel referenceCacheLevel)
{
ContentType = contentType;
Key = key;
@@ -32,34 +30,32 @@ namespace Umbraco.Web.PublishedCache
.PropertyTypes
.Select(propertyType =>
{
- object value;
- values.TryGetValue(propertyType.PropertyTypeAlias, out value);
- return facadeService.CreateFragmentProperty(propertyType, Key, previewing, referenceCacheLevel, value);
+ values.TryGetValue(propertyType.PropertyTypeAlias, out object value);
+ return facadeService.CreateSetProperty(propertyType, Key, previewing, referenceCacheLevel, value);
})
.ToArray();
}
- // initializes a new instance of the PublishedFragment class
+ // initializes a new instance of the PropertySet class
// without any context, so it's purely 'standalone' and should NOT interfere with the facade service
- public PublishedFragment(PublishedContentType contentType, Guid key, Dictionary values, bool previewing)
+ public PropertySet(PublishedContentType contentType, Guid key, Dictionary values, bool previewing)
{
ContentType = contentType;
Key = key;
values = GetCaseInsensitiveValueDictionary(values);
- // using an initial reference cache level of .None ensures that
- // everything will be cached at .Content level
- // that reference cache level will propagate to all properties
+ // using an initial reference cache level of .None ensures that everything will be
+ // cached at .Content level - and that reference cache level will propagate to all
+ // properties
const PropertyCacheLevel cacheLevel = PropertyCacheLevel.None;
_propertiesArray = contentType
.PropertyTypes
.Select(propertyType =>
{
- object value;
- values.TryGetValue(propertyType.PropertyTypeAlias, out value);
- return (IPublishedProperty) new PublishedFragmentProperty(propertyType, Key, previewing, cacheLevel, value);
+ values.TryGetValue(propertyType.PropertyTypeAlias, out object value);
+ return (IPublishedProperty) new PropertySetProperty(propertyType, Key, previewing, cacheLevel, value);
})
.ToArray();
}
@@ -68,7 +64,7 @@ namespace Umbraco.Web.PublishedCache
{
// ensure we ignore case for property aliases
var comparer = values.Comparer;
- var ignoreCase = comparer == StringComparer.OrdinalIgnoreCase || comparer == StringComparer.InvariantCultureIgnoreCase || comparer == StringComparer.CurrentCultureIgnoreCase;
+ var ignoreCase = Equals(comparer, StringComparer.OrdinalIgnoreCase) || Equals(comparer, StringComparer.InvariantCultureIgnoreCase) || Equals(comparer, StringComparer.CurrentCultureIgnoreCase);
return ignoreCase ? values : new Dictionary(values, StringComparer.OrdinalIgnoreCase);
}
@@ -78,7 +74,7 @@ namespace Umbraco.Web.PublishedCache
#endregion
- #region Content
+ #region PropertySet
public Guid Key { get; }
diff --git a/src/Umbraco.Web/PublishedCache/PublishedFragmentProperty.cs b/src/Umbraco.Web/PublishedCache/PropertySetProperty.cs
similarity index 68%
rename from src/Umbraco.Web/PublishedCache/PublishedFragmentProperty.cs
rename to src/Umbraco.Web/PublishedCache/PropertySetProperty.cs
index 353810caf5..4faa2090aa 100644
--- a/src/Umbraco.Web/PublishedCache/PublishedFragmentProperty.cs
+++ b/src/Umbraco.Web/PublishedCache/PropertySetProperty.cs
@@ -4,9 +4,9 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PublishedCache
{
- class PublishedFragmentProperty : PublishedFragmentPropertyBase
+ class PropertySetProperty : PropertySetPropertyBase
{
- public PublishedFragmentProperty(PublishedPropertyType propertyType, Guid fragmentKey, bool previewing, PropertyCacheLevel cacheLevel, object sourceValue = null)
+ public PropertySetProperty(PublishedPropertyType propertyType, Guid fragmentKey, bool previewing, PropertyCacheLevel cacheLevel, object sourceValue = null)
: base(propertyType, fragmentKey, previewing, cacheLevel, sourceValue)
{ }
diff --git a/src/Umbraco.Web/PublishedCache/PublishedFragmentPropertyBase.cs b/src/Umbraco.Web/PublishedCache/PropertySetPropertyBase.cs
similarity index 95%
rename from src/Umbraco.Web/PublishedCache/PublishedFragmentPropertyBase.cs
rename to src/Umbraco.Web/PublishedCache/PropertySetPropertyBase.cs
index 06df7df1d7..d31a581987 100644
--- a/src/Umbraco.Web/PublishedCache/PublishedFragmentPropertyBase.cs
+++ b/src/Umbraco.Web/PublishedCache/PropertySetPropertyBase.cs
@@ -4,7 +4,7 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PublishedCache
{
- internal abstract class PublishedFragmentPropertyBase : PublishedPropertyBase
+ internal abstract class PropertySetPropertyBase : PublishedPropertyBase
{
private readonly object _locko = new object();
private readonly object _sourceValue;
@@ -18,7 +18,7 @@ namespace Umbraco.Web.PublishedCache
private CacheValues _cacheValues;
// initializes a published item property
- protected PublishedFragmentPropertyBase(PublishedPropertyType propertyType, Guid fragmentKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
+ protected PropertySetPropertyBase(PublishedPropertyType propertyType, Guid fragmentKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
: base(propertyType, referenceCacheLevel)
{
_sourceValue = sourceValue;
diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/FacadeService.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/FacadeService.cs
index 7f5edf8965..073608c660 100644
--- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/FacadeService.cs
+++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/FacadeService.cs
@@ -238,9 +238,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
#endregion
- #region Fragments
+ #region Property Set
- public override IPublishedProperty CreateFragmentProperty(PublishedPropertyType propertyType, Guid itemKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
+ public override IPublishedProperty CreateSetProperty(PublishedPropertyType propertyType, Guid setKey, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null)
{
throw new NotImplementedException();
}
diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs
index d7a5ade1b8..8e0aaf1fcc 100644
--- a/src/Umbraco.Web/PublishedContentExtensions.cs
+++ b/src/Umbraco.Web/PublishedContentExtensions.cs
@@ -219,7 +219,7 @@ namespace Umbraco.Web
#region Search
- public static IEnumerable Search(this IPublishedContent content, string term, bool useWildCards = true, string searchProvider = null)
+ public static IEnumerable Search(this IPublishedContent content, string term, bool useWildCards = true, string searchProvider = null)
{
var searcher = Examine.ExamineManager.Instance.DefaultSearchProvider;
if (string.IsNullOrEmpty(searchProvider) == false)
@@ -235,12 +235,12 @@ namespace Umbraco.Web
return content.Search(crit, searcher);
}
- public static IEnumerable SearchDescendants(this IPublishedContent content, string term, bool useWildCards = true, string searchProvider = null)
+ public static IEnumerable SearchDescendants(this IPublishedContent content, string term, bool useWildCards = true, string searchProvider = null)
{
return content.Search(term, useWildCards, searchProvider);
}
- public static IEnumerable SearchChildren(this IPublishedContent content, string term, bool useWildCards = true, string searchProvider = null)
+ public static IEnumerable SearchChildren(this IPublishedContent content, string term, bool useWildCards = true, string searchProvider = null)
{
var searcher = Examine.ExamineManager.Instance.DefaultSearchProvider;
if (string.IsNullOrEmpty(searchProvider) == false)
@@ -256,14 +256,14 @@ namespace Umbraco.Web
return content.Search(crit, searcher);
}
- public static IEnumerable Search(this IPublishedContent content, Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
+ public static IEnumerable Search(this IPublishedContent content, Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
{
var s = Examine.ExamineManager.Instance.DefaultSearchProvider;
if (searchProvider != null)
s = searchProvider;
var results = s.Search(criteria);
- return results.ConvertSearchResultToPublishedContent(UmbracoContext.Current.ContentCache);
+ return results.ToPublishedSearchResults(UmbracoContext.Current.ContentCache);
}
#endregion
diff --git a/src/Umbraco.Web/PublishedContentQuery.cs b/src/Umbraco.Web/PublishedContentQuery.cs
index 5b8688e0e2..7f8185e6e1 100644
--- a/src/Umbraco.Web/PublishedContentQuery.cs
+++ b/src/Umbraco.Web/PublishedContentQuery.cs
@@ -206,7 +206,7 @@ namespace Umbraco.Web
///
///
///
- public IEnumerable Search(string term, bool useWildCards = true, string searchProvider = null)
+ public IEnumerable Search(string term, bool useWildCards = true, string searchProvider = null)
{
if (_query != null) return _query.Search(term, useWildCards, searchProvider);
@@ -215,7 +215,7 @@ namespace Umbraco.Web
searcher = Examine.ExamineManager.Instance.SearchProviderCollection[searchProvider];
var results = searcher.Search(term, useWildCards);
- return results.ConvertSearchResultToPublishedContent(_contentCache);
+ return results.ToPublishedSearchResults(_contentCache);
}
///
@@ -224,7 +224,7 @@ namespace Umbraco.Web
///
///
///
- public IEnumerable Search(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
+ public IEnumerable Search(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
{
if (_query != null) return _query.Search(criteria, searchProvider);
@@ -233,7 +233,7 @@ namespace Umbraco.Web
s = searchProvider;
var results = s.Search(criteria);
- return results.ConvertSearchResultToPublishedContent(_contentCache);
+ return results.ToPublishedSearchResults(_contentCache);
}
#endregion
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 118b5c42b3..c573acc40e 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -217,10 +217,10 @@
-
-
-
-
+
+
+
+
@@ -265,7 +265,7 @@
-
+
diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs
index 964270319d..28aa96ec25 100644
--- a/src/Umbraco.Web/UmbracoHelper.cs
+++ b/src/Umbraco.Web/UmbracoHelper.cs
@@ -816,7 +816,7 @@ namespace Umbraco.Web
///
///
///
- public IEnumerable Search(string term, bool useWildCards = true, string searchProvider = null)
+ public IEnumerable Search(string term, bool useWildCards = true, string searchProvider = null)
{
return ContentQuery.Search(term, useWildCards, searchProvider);
}
@@ -827,7 +827,7 @@ namespace Umbraco.Web
///
///
///
- public IEnumerable Search(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
+ public IEnumerable Search(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null)
{
return ContentQuery.Search(criteria, searchProvider);
}