moved more utilities
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
public enum Direction
|
||||
{
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -10,6 +9,45 @@ namespace Umbraco.Core
|
||||
///</summary>
|
||||
public static class EnumerableExtensions
|
||||
{
|
||||
// based upon the original Zip<T1, T2, TResult> method
|
||||
public static IEnumerable<TResult> Zip<T1, T2, T3, TResult>(this IEnumerable<T1> e1, IEnumerable<T2> e2, IEnumerable<T3> e3,
|
||||
Func<T1, T2, T3, TResult> resultSelector)
|
||||
{
|
||||
if (e1 == null) throw new ArgumentNullException("e1");
|
||||
if (e2 == null) throw new ArgumentNullException("e2");
|
||||
if (e3 == null) throw new ArgumentNullException("e3");
|
||||
if (resultSelector == null) throw new ArgumentNullException("resultSelector");
|
||||
return ZipIterator(e1, e2, e3, resultSelector);
|
||||
}
|
||||
|
||||
private static IEnumerable<TResult> ZipIterator<T1, T2, T3, TResult>(IEnumerable<T1> ie1, IEnumerable<T2> ie2, IEnumerable<T3> ie3,
|
||||
Func<T1, T2, T3, TResult> resultSelector)
|
||||
{
|
||||
var e1 = ie1.GetEnumerator();
|
||||
try
|
||||
{
|
||||
var e2 = ie2.GetEnumerator();
|
||||
var e3 = ie3.GetEnumerator();
|
||||
try
|
||||
{
|
||||
while (e1.MoveNext() && e2.MoveNext() && e3.MoveNext())
|
||||
yield return resultSelector(e1.Current, e2.Current, e3.Current);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (e2 != null)
|
||||
e2.Dispose();
|
||||
if (e3 != null)
|
||||
e3.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (e1 != null)
|
||||
e1.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool HasDuplicates<T>(this IEnumerable<T> items, bool includeNull)
|
||||
{
|
||||
var hs = new HashSet<T>();
|
||||
@@ -1,50 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides extensions to the List type.
|
||||
/// </summary>
|
||||
internal static class ListExtensions
|
||||
{
|
||||
// based upon the original Zip<T1, T2, TResult> method
|
||||
public static IEnumerable<TResult> Zip<T1, T2, T3, TResult>(this IEnumerable<T1> e1, IEnumerable<T2> e2, IEnumerable<T3> e3,
|
||||
Func<T1, T2, T3, TResult> resultSelector)
|
||||
{
|
||||
if (e1 == null) throw new ArgumentNullException("e1");
|
||||
if (e2 == null) throw new ArgumentNullException("e2");
|
||||
if (e3 == null) throw new ArgumentNullException("e3");
|
||||
if (resultSelector == null) throw new ArgumentNullException("resultSelector");
|
||||
return ZipIterator(e1, e2, e3, resultSelector);
|
||||
}
|
||||
|
||||
private static IEnumerable<TResult> ZipIterator<T1, T2,T3, TResult>(IEnumerable<T1> ie1, IEnumerable<T2> ie2, IEnumerable<T3> ie3,
|
||||
Func<T1, T2, T3, TResult> resultSelector)
|
||||
{
|
||||
var e1 = ie1.GetEnumerator();
|
||||
try
|
||||
{
|
||||
var e2 = ie2.GetEnumerator();
|
||||
var e3 = ie3.GetEnumerator();
|
||||
try
|
||||
{
|
||||
while (e1.MoveNext() && e2.MoveNext() && e3.MoveNext())
|
||||
yield return resultSelector(e1.Current, e2.Current, e3.Current);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (e2 != null)
|
||||
e2.Dispose();
|
||||
if (e3 != null)
|
||||
e3.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (e1 != null)
|
||||
e1.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,7 +560,6 @@
|
||||
<Compile Include="DataTableExtensions.cs" />
|
||||
<Compile Include="DateTimeExtensions.cs" />
|
||||
<Compile Include="DecimalExtensions.cs" />
|
||||
<Compile Include="DelegateEqualityComparer.cs" />
|
||||
<Compile Include="DelegateExtensions.cs" />
|
||||
<Compile Include="Deploy\ArtifactBase.cs" />
|
||||
<Compile Include="Deploy\ArtifactDependency.cs" />
|
||||
@@ -590,7 +589,6 @@
|
||||
<Compile Include="Dictionary\ICultureDictionaryFactory.cs" />
|
||||
<Compile Include="Logging\DisposableTimer.cs" />
|
||||
<Compile Include="EmailSender.cs" />
|
||||
<Compile Include="EnumerableExtensions.cs" />
|
||||
<Compile Include="Events\CancellableEventArgs.cs" />
|
||||
<Compile Include="Events\CancellableObjectEventArgs.cs" />
|
||||
<Compile Include="Events\ContentCacheEventArgs.cs" />
|
||||
@@ -651,7 +649,6 @@
|
||||
<Compile Include="HttpContextExtensions.cs" />
|
||||
<Compile Include="IDisposeOnRequestEnd.cs" />
|
||||
<Compile Include="IEmailSender.cs" />
|
||||
<Compile Include="IfExtensions.cs" />
|
||||
<Compile Include="IntExtensions.cs" />
|
||||
<Compile Include="IO\FileSecurityException.cs" />
|
||||
<Compile Include="IO\FileSystemExtensions.cs" />
|
||||
@@ -670,7 +667,6 @@
|
||||
<Compile Include="IRuntime.cs" />
|
||||
<Compile Include="IRuntimeState.cs" />
|
||||
<Compile Include="LambdaExpressionCacheKey.cs" />
|
||||
<Compile Include="ListExtensions.cs" />
|
||||
<Compile Include="Logging\DebugDiagnosticsLogger.cs" />
|
||||
<Compile Include="Logging\ILogger.cs" />
|
||||
<Compile Include="Logging\IProfiler.cs" />
|
||||
@@ -941,7 +937,6 @@
|
||||
<Compile Include="Persistence\DatabaseModelDefinitions\DbIndexDefinition.cs" />
|
||||
<Compile Include="Persistence\DatabaseModelDefinitions\DefinitionFactory.cs" />
|
||||
<Compile Include="Persistence\DatabaseModelDefinitions\DeletionDataDefinition.cs" />
|
||||
<Compile Include="Persistence\DatabaseModelDefinitions\Direction.cs" />
|
||||
<Compile Include="Persistence\DatabaseModelDefinitions\ForeignKeyDefinition.cs" />
|
||||
<Compile Include="Persistence\DatabaseModelDefinitions\IndexColumnDefinition.cs" />
|
||||
<Compile Include="Persistence\DatabaseModelDefinitions\IndexDefinition.cs" />
|
||||
|
||||
@@ -3,9 +3,9 @@ using NUnit.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging.Viewer;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Tests.Logging
|
||||
{
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Dtos;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.Repositories.Implement;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
|
||||
@@ -3,20 +3,18 @@ using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Dtos;
|
||||
using Umbraco.Core.Persistence.Repositories.Implement;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace Umbraco.Web.Editors
|
||||
},
|
||||
{
|
||||
"logApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<LogController>(
|
||||
controller => controller.GetPagedEntityLog(0, 0, 0, Core.Persistence.DatabaseModelDefinitions.Direction.Ascending, null))
|
||||
controller => controller.GetPagedEntityLog(0, 0, 0, Direction.Ascending, null))
|
||||
},
|
||||
{
|
||||
"memberApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<MemberController>(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging.Viewer;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user