moving custombooleantypeconverter

moving custombooleantypeconverter to abstractions
This commit is contained in:
Carole Rennie Logan
2019-05-20 16:48:08 +01:00
parent 4da063369d
commit 79e447239f
2 changed files with 1 additions and 2 deletions

View File

@@ -1,32 +0,0 @@
using System;
using System.ComponentModel;
namespace Umbraco.Core
{
/// <summary>
/// Allows for converting string representations of 0 and 1 to boolean
/// </summary>
internal class CustomBooleanTypeConverter : BooleanConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
var str = (string)value;
if (str == null || str.Length == 0 || str == "0") return false;
if (str == "1") return true;
}
return base.ConvertFrom(context, culture, value);
}
}
}

View File

@@ -529,7 +529,6 @@
<Compile Include="RuntimeOptions.cs" />
<Compile Include="Runtime\CoreRuntime.cs" />
<Compile Include="Runtime\CoreInitialComponent.cs" />
<Compile Include="CustomBooleanTypeConverter.cs" />
<Compile Include="Migrations\Expressions\Common\ExecutableBuilder.cs" />
<Compile Include="Migrations\Expressions\Common\IExecutableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\KeysAndIndexes\CreateKeysAndIndexesBuilder.cs" />