Merge remote-tracking branch 'origin/7.0.0' into 7.0.0--property-editor-guid-to-alias
Conflicts: src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs src/Umbraco.Core/Persistence/Migrations/Syntax/Alter/Expressions/AlterColumnExpression.cs src/Umbraco.Core/PropertyEditors/TinyMcePropertyEditorValueConverter.cs src/Umbraco.Core/XmlHelper.cs src/Umbraco.Tests/ObjectExtensionsTests.cs src/Umbraco.Web/PropertyEditors/RteMacroRenderingPropertyEditorValueConverter.cs src/Umbraco.Web/Routing/DefaultUrlProvider.cs src/Umbraco.Web/Umbraco.Web.csproj src/Umbraco.Web/umbraco.presentation/macro.cs
This commit is contained in:
@@ -50,14 +50,14 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
try
|
||||
{
|
||||
var converted = (T)input;
|
||||
return new Attempt<T>(true, converted);
|
||||
return Attempt.Succeed(converted);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Attempt<T>(e);
|
||||
return Attempt<T>.Fail(e);
|
||||
}
|
||||
}
|
||||
return !result.Success ? Attempt<T>.False : new Attempt<T>(true, (T)result.Result);
|
||||
return !result.Success ? Attempt<T>.Fail() : Attempt.Succeed((T)result.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,22 +69,22 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
/// <returns></returns>
|
||||
public static Attempt<object> TryConvertTo(this object input, Type destinationType)
|
||||
{
|
||||
if (input == null) return Attempt<object>.False;
|
||||
if (input == null) return Attempt<object>.Fail();
|
||||
|
||||
if (destinationType == typeof(object)) return new Attempt<object>(true, input);
|
||||
if (destinationType == typeof(object)) return Attempt.Succeed(input);
|
||||
|
||||
if (input.GetType() == destinationType) return new Attempt<object>(true, input);
|
||||
if (input.GetType() == destinationType) return Attempt.Succeed(input);
|
||||
|
||||
if (input is string && destinationType.IsEnum)
|
||||
{
|
||||
try
|
||||
{
|
||||
var output = Enum.Parse(destinationType, (string)input, true);
|
||||
return new Attempt<object>(true, output);
|
||||
return Attempt.Succeed(output);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Attempt<object>(e);
|
||||
{
|
||||
return Attempt<object>.Succeed(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
try
|
||||
{
|
||||
var casted = Convert.ChangeType(input, destinationType);
|
||||
return new Attempt<object>(true, casted);
|
||||
return Attempt<object>.Succeed(casted);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Attempt<object>(e);
|
||||
return Attempt<object>.Fail(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,11 +114,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
try
|
||||
{
|
||||
var converted = inputConverter.ConvertTo(input, destinationType);
|
||||
return new Attempt<object>(true, converted);
|
||||
return Attempt<object>.Succeed(converted);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Attempt<object>(e);
|
||||
return Attempt<object>.Fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,11 +130,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
try
|
||||
{
|
||||
var converted = boolConverter.ConvertFrom(input);
|
||||
return new Attempt<object>(true, converted);
|
||||
return Attempt<object>.Succeed(converted);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Attempt<object>(e);
|
||||
return Attempt<object>.Fail(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,11 +145,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
try
|
||||
{
|
||||
var converted = outputConverter.ConvertFrom(input);
|
||||
return new Attempt<object>(true, converted);
|
||||
return Attempt<object>.Succeed(converted);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Attempt<object>(e);
|
||||
return Attempt<object>.Fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,15 +159,15 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
try
|
||||
{
|
||||
var casted = Convert.ChangeType(input, destinationType);
|
||||
return new Attempt<object>(true, casted);
|
||||
return Attempt<object>.Succeed(casted);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new Attempt<object>(e);
|
||||
return Attempt<object>.Fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
return Attempt<object>.False;
|
||||
return Attempt<object>.Fail();
|
||||
}
|
||||
|
||||
public static void CheckThrowObjectDisposed(this IDisposable disposable, bool isDisposed, string objectname)
|
||||
|
||||
Reference in New Issue
Block a user