diff --git a/src/Umbraco.Core/EnumerableExtensions.cs b/src/Umbraco.Core/EnumerableExtensions.cs
index 781d269070..349c374bb7 100644
--- a/src/Umbraco.Core/EnumerableExtensions.cs
+++ b/src/Umbraco.Core/EnumerableExtensions.cs
@@ -17,21 +17,41 @@ namespace Umbraco.Core
throw new NullReferenceException("source");
// enumerate the source only once!
- var enumerator = source.GetEnumerator();
-
- while (enumerator.MoveNext())
- yield return EnumerateGroup(enumerator, groupSize);
+ return new InGroupsEnumerator(source, groupSize).Groups();
}
- private static IEnumerable EnumerateGroup(IEnumerator enumerator, int count)
+ // this class makes sure that the source is enumerated only ONCE
+ // which means that when it is enumerated, the actual groups content
+ // has to be evaluated at the same time, and stored in an array.
+ private class InGroupsEnumerator
{
- var c = 1;
- do
- {
- yield return enumerator.Current;
- } while (c++ < count && enumerator.MoveNext());
- }
+ private readonly IEnumerator _source;
+ private readonly int _count;
+ private bool _mightHaveNext;
+ public InGroupsEnumerator(IEnumerable source, int count)
+ {
+ _source = source.GetEnumerator();
+ _count = count;
+ _mightHaveNext = true;
+ }
+
+ public IEnumerable> Groups()
+ {
+ while (_mightHaveNext && _source.MoveNext())
+ yield return Group().ToArray(); // see note above
+ }
+
+ private IEnumerable Group()
+ {
+ var c = 0;
+ do
+ {
+ yield return _source.Current;
+ } while (++c < _count && _source.MoveNext());
+ _mightHaveNext = c == _count;
+ }
+ }
/// The distinct by.
/// The source.
diff --git a/src/Umbraco.Core/Profiling/ProfilingView.cs b/src/Umbraco.Core/Profiling/ProfilingView.cs
new file mode 100644
index 0000000000..110ab14925
--- /dev/null
+++ b/src/Umbraco.Core/Profiling/ProfilingView.cs
@@ -0,0 +1,28 @@
+using System.IO;
+using System.Web.Mvc;
+
+namespace Umbraco.Core.Profiling
+{
+ public class ProfilingView : IView
+ {
+ private readonly IView _inner;
+ private readonly string _name;
+ private readonly string _viewPath;
+
+ public ProfilingView(IView inner)
+ {
+ _inner = inner;
+ _name = inner.GetType().Name;
+ var razorView = inner as RazorView;
+ _viewPath = razorView != null ? razorView.ViewPath : "Unknown";
+ }
+
+ public void Render(ViewContext viewContext, TextWriter writer)
+ {
+ using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.Render: {1}", _name, _viewPath)))
+ {
+ _inner.Render(viewContext, writer);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs b/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs
new file mode 100644
index 0000000000..5df2b6f811
--- /dev/null
+++ b/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs
@@ -0,0 +1,48 @@
+using System.Web.Mvc;
+
+namespace Umbraco.Core.Profiling
+{
+ public class ProfilingViewEngine: IViewEngine
+ {
+ private readonly IViewEngine _inner;
+ private readonly string _name;
+
+ public ProfilingViewEngine(IViewEngine inner)
+ {
+ _inner = inner;
+ _name = inner.GetType().Name;
+ }
+
+ public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache)
+ {
+ using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.FindPartialView, {1}, {2}", _name, partialViewName, useCache)))
+ {
+ return WrapResult(_inner.FindPartialView(controllerContext, partialViewName, useCache));
+ }
+ }
+
+ public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
+ {
+ using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.FindView, {1}, {2}, {3}", _name, viewName, masterName, useCache)))
+ {
+ return WrapResult(_inner.FindView(controllerContext, viewName, masterName, useCache));
+ }
+ }
+
+ private static ViewEngineResult WrapResult(ViewEngineResult innerResult)
+ {
+ var profiledResult = innerResult.View != null ?
+ new ViewEngineResult(new ProfilingView(innerResult.View), innerResult.ViewEngine) :
+ new ViewEngineResult(innerResult.SearchedLocations);
+ return profiledResult;
+ }
+
+ public void ReleaseView(ControllerContext controllerContext, IView view)
+ {
+ using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.ReleaseView, {1}", _name, view.GetType().Name)))
+ {
+ _inner.ReleaseView(controllerContext, view);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs
index 8582324c51..eebd7ff1e8 100644
--- a/src/Umbraco.Core/StringExtensions.cs
+++ b/src/Umbraco.Core/StringExtensions.cs
@@ -999,7 +999,7 @@ namespace Umbraco.Core
/// strings are cleaned up to camelCase and Ascii.
/// The clean string.
/// The string is cleaned in the context of the IShortStringHelper default culture.
- public static string ToCleanString(string text, CleanStringType stringType)
+ public static string ToCleanString(this string text, CleanStringType stringType)
{
return ShortStringHelper.CleanString(text, stringType);
}
@@ -1013,7 +1013,7 @@ namespace Umbraco.Core
/// The separator.
/// The clean string.
/// The string is cleaned in the context of the IShortStringHelper default culture.
- public static string ToCleanString(string text, CleanStringType stringType, char separator)
+ public static string ToCleanString(this string text, CleanStringType stringType, char separator)
{
return ShortStringHelper.CleanString(text, stringType, separator);
}
@@ -1026,7 +1026,7 @@ namespace Umbraco.Core
/// strings are cleaned up to camelCase and Ascii.
/// The culture.
/// The clean string.
- public static string ToCleanString(string text, CleanStringType stringType, CultureInfo culture)
+ public static string ToCleanString(this string text, CleanStringType stringType, CultureInfo culture)
{
return ShortStringHelper.CleanString(text, stringType, culture);
}
@@ -1040,7 +1040,7 @@ namespace Umbraco.Core
/// The separator.
/// The culture.
/// The clean string.
- public static string ToCleanString(string text, CleanStringType stringType, char separator, CultureInfo culture)
+ public static string ToCleanString(this string text, CleanStringType stringType, char separator, CultureInfo culture)
{
return ShortStringHelper.CleanString(text, stringType, separator, culture);
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 954c832dc6..0671b9a5b5 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -584,6 +584,8 @@
+
+
diff --git a/src/Umbraco.Tests/BusinessLogic/BaseTest.cs b/src/Umbraco.Tests/BusinessLogic/BaseTest.cs
index 692e0d6586..7fe009ffd7 100644
--- a/src/Umbraco.Tests/BusinessLogic/BaseTest.cs
+++ b/src/Umbraco.Tests/BusinessLogic/BaseTest.cs
@@ -7,7 +7,7 @@ using Umbraco.Core;
using Umbraco.Tests.TestHelpers;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
-using umbraco.IO;
+using Umbraco.Core.IO;
using GlobalSettings = umbraco.GlobalSettings;
namespace Umbraco.Tests.BusinessLogic
diff --git a/src/Umbraco.Tests/CodeFirst/ContentTypeMapper.cs b/src/Umbraco.Tests/CodeFirst/ContentTypeMapper.cs
index 80ddb57835..149eb19080 100644
--- a/src/Umbraco.Tests/CodeFirst/ContentTypeMapper.cs
+++ b/src/Umbraco.Tests/CodeFirst/ContentTypeMapper.cs
@@ -19,9 +19,9 @@ namespace Umbraco.Tests.CodeFirst
foreach (var property in content.Properties)
{
- var @alias = property.PropertyTypeAlias;
+ var @alias = property.PropertyTypeAlias.ToLowerInvariant();
- var propertyInfo = propertyInfos.FirstOrDefault(x => x.Name.ToUmbracoAlias() == @alias);
+ var propertyInfo = propertyInfos.FirstOrDefault(x => x.Name.ToLowerInvariant() == @alias);
if (propertyInfo == null) continue;
object value = null;
diff --git a/src/Umbraco.Tests/CodeFirst/TypeInheritanceTest.cs b/src/Umbraco.Tests/CodeFirst/TypeInheritanceTest.cs
index e53d8552e8..ccc5d887f5 100644
--- a/src/Umbraco.Tests/CodeFirst/TypeInheritanceTest.cs
+++ b/src/Umbraco.Tests/CodeFirst/TypeInheritanceTest.cs
@@ -64,9 +64,9 @@ namespace Umbraco.Tests.CodeFirst
}
Assert.That(list.Count, Is.EqualTo(3));
- Assert.That(list.Any(x => x == "meta"), Is.True);
- Assert.That(list.Any(x => x == "metaSeo"), Is.True);
- Assert.That(list.Any(x => x == "base"), Is.True);
+ Assert.Contains("Meta", list);
+ Assert.Contains("MetaSeo", list);
+ Assert.Contains("Base", list);
}
[Test]
diff --git a/src/Umbraco.Tests/CoreStrings/CmsHelperCasingTests.cs b/src/Umbraco.Tests/CoreStrings/CmsHelperCasingTests.cs
index 477a9a5b05..500c0ef81f 100644
--- a/src/Umbraco.Tests/CoreStrings/CmsHelperCasingTests.cs
+++ b/src/Umbraco.Tests/CoreStrings/CmsHelperCasingTests.cs
@@ -17,7 +17,8 @@ namespace Umbraco.Tests.CoreStrings
[TestCase("t", "t")]
[TestCase("thisis", "Thisis")]
[TestCase("ThisIsTheEnd", "This Is The End")]
- [TestCase("WhoIsNumber6InTheVillage", "Who Is Number6In The Village")] // note the issue with Number6In
+ //[TestCase("WhoIsNumber6InTheVillage", "Who Is Number6In The Village")] // note the issue with Number6In
+ [TestCase("WhoIsNumber6InTheVillage", "Who Is Number6 In The Village")] // now fixed since DefaultShortStringHelper is the default
public void SpaceCamelCasing(string input, string expected)
{
var output = umbraco.cms.helpers.Casing.SpaceCamelCasing(input);
diff --git a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs
index d31e6dbec8..ea62370655 100644
--- a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs
+++ b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs
@@ -10,7 +10,7 @@ using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
using Umbraco.Web.Routing;
using umbraco.BusinessLogic;
-using umbraco.IO;
+using Umbraco.Core.IO;
using umbraco.cms.businesslogic.cache;
using umbraco.cms.businesslogic.template;
diff --git a/src/Umbraco.Web.UI/install/steps/theend.ascx b/src/Umbraco.Web.UI/install/steps/theend.ascx
index b2b4ffe395..ea0d00696c 100644
--- a/src/Umbraco.Web.UI/install/steps/theend.ascx
+++ b/src/Umbraco.Web.UI/install/steps/theend.ascx
@@ -31,8 +31,8 @@ jQuery(document).ready(function () {
If you installed a starter kit you can start by configuring your new site, just click "Preview your new website" and follow the instructions. Or to start adding content right away click "Set up your new website"
diff --git a/src/Umbraco.Web.UI/umbraco/Default.aspx b/src/Umbraco.Web.UI/umbraco/Default.aspx
index 963ced80c2..d3421e3997 100644
--- a/src/Umbraco.Web.UI/umbraco/Default.aspx
+++ b/src/Umbraco.Web.UI/umbraco/Default.aspx
@@ -12,7 +12,7 @@
}
-
+