Skip to main content

AutoMappingUtils

Assembly: ServiceStack.Text.dll
View Source
Declaration
public static class AutoMappingUtils

Methods

Reset()

View Source
Declaration
public static void Reset()

ShouldIgnoreMapping(Type, Type)

View Source
Declaration
public static bool ShouldIgnoreMapping(Type fromType, Type toType)
Returns

System.Boolean

Parameters
TypeName
System.TypefromType
System.TypetoType

GetConverter(Type, Type)

View Source
Declaration
public static GetMemberDelegate GetConverter(Type fromType, Type toType)
Returns

ServiceStack.GetMemberDelegate

Parameters
TypeName
System.TypefromType
System.TypetoType

GetPopulator(Type, Type)

View Source
Declaration
public static PopulateMemberDelegate GetPopulator(Type targetType, Type sourceType)
Returns

ServiceStack.PopulateMemberDelegate

Parameters
TypeName
System.TypetargetType
System.TypesourceType

ConvertTo<T>(Object, T)

View Source
Declaration
public static T ConvertTo<T>(this object from, T defaultValue)
Returns

<T>

Parameters
TypeName
System.Objectfrom
<T>defaultValue
Type Parameters
  • T

ConvertTo<T>(Object)

View Source
Declaration
public static T ConvertTo<T>(this object from)
Returns

<T>

Parameters
TypeName
System.Objectfrom
Type Parameters
  • T

ConvertTo<T>(Object, Boolean)

View Source
Declaration
public static T ConvertTo<T>(this object from, bool skipConverters)
Returns

<T>

Parameters
TypeName
System.Objectfrom
System.BooleanskipConverters
Type Parameters
  • T

CreateCopy<T>(T)

View Source
Declaration
public static T CreateCopy<T>(this T from)
Returns

<T>

Parameters
TypeName
<T>from
Type Parameters
  • T

ThenDo<To>(To, Action<To>)

View Source
Declaration
public static To ThenDo<To>(this To to, Action<To> fn)
Returns

<To>

Parameters
TypeName
<To>to
System.Action<<To>>fn
Type Parameters
  • To

ConvertTo(Object, Type)

View Source
Declaration
public static object ConvertTo(this object from, Type toType)
Returns

System.Object

Parameters
TypeName
System.Objectfrom
System.TypetoType

ConvertTo(Object, Type, Boolean)

View Source
Declaration
public static object ConvertTo(this object from, Type toType, bool skipConverters)
Returns

System.Object

Parameters
TypeName
System.Objectfrom
System.TypetoType
System.BooleanskipConverters

GetImplicitCastMethod(Type, Type)

View Source
Declaration
public static MethodInfo GetImplicitCastMethod(Type fromType, Type toType)
Returns

System.Reflection.MethodInfo

Parameters
TypeName
System.TypefromType
System.TypetoType

GetExplicitCastMethod(Type, Type)

View Source
Declaration
public static MethodInfo GetExplicitCastMethod(Type fromType, Type toType)
Returns

System.Reflection.MethodInfo

Parameters
TypeName
System.TypefromType
System.TypetoType

ChangeValueType(Object, Type)

View Source
Declaration
public static object ChangeValueType(object from, Type toType)
Returns

System.Object

Parameters
TypeName
System.Objectfrom
System.TypetoType

ChangeTo(String, Type)

View Source
Declaration
public static object ChangeTo(this string strValue, Type type)
Returns

System.Object

Parameters
TypeName
System.StringstrValue
System.Typetype

GetPropertyNames(Type)

View Source
Declaration
public static List<string> GetPropertyNames(this Type type)
Returns

System.Collections.Generic.List<System.String>

Parameters
TypeName
System.Typetype

GetAssemblyPath(Type)

View Source
Declaration
public static string GetAssemblyPath(this Type source)
Returns

System.String

Parameters
TypeName
System.Typesource

IsDebugBuild(Assembly)

View Source
Declaration
public static bool IsDebugBuild(this Assembly assembly)
Returns

System.Boolean

Parameters
TypeName
System.Reflection.Assemblyassembly

PopulateWith(Object)

Populate an object with Example data.

View Source
Declaration
public static object PopulateWith(object obj)
Returns

System.Object

Parameters
TypeName
System.Objectobj

GetDefaultValue(Type)

View Source
Declaration
public static object GetDefaultValue(this Type type)
Returns

System.Object

Parameters
TypeName
System.Typetype

IsDefaultValue(Object)

View Source
Declaration
public static bool IsDefaultValue(object value)
Returns

System.Boolean

Parameters
TypeName
System.Objectvalue

IsDefaultValue(Object, Type)

View Source
Declaration
public static bool IsDefaultValue(object value, Type valueType)
Returns

System.Boolean

Parameters
TypeName
System.Objectvalue
System.TypevalueType

PopulateWith<To, From>(To, From)

View Source
Declaration
public static To PopulateWith<To, From>(this To to, From from)
Returns

<To>

Parameters
TypeName
<To>to
<From>from
Type Parameters
  • To
  • From

PopulateWithNonDefaultValues<To, From>(To, From)

View Source
Declaration
public static To PopulateWithNonDefaultValues<To, From>(this To to, From from)
Returns

<To>

Parameters
TypeName
<To>to
<From>from
Type Parameters
  • To
  • From

PopulateFromPropertiesWithAttribute<To, From>(To, From, Type)

View Source
Declaration
public static To PopulateFromPropertiesWithAttribute<To, From>(this To to, From from, Type attributeType)
Returns

<To>

Parameters
TypeName
<To>to
<From>from
System.TypeattributeType
Type Parameters
  • To
  • From

PopulateFromPropertiesWithoutAttribute<To, From>(To, From, Type)

View Source
Declaration
public static To PopulateFromPropertiesWithoutAttribute<To, From>(this To to, From from, Type attributeType)
Returns

<To>

Parameters
TypeName
<To>to
<From>from
System.TypeattributeType
Type Parameters
  • To
  • From

SetProperty(PropertyInfo, Object, Object)

View Source
Declaration
public static void SetProperty(this PropertyInfo propertyInfo, object obj, object value)
Parameters
TypeName
System.Reflection.PropertyInfopropertyInfo
System.Objectobj
System.Objectvalue

GetProperty(PropertyInfo, Object)

View Source
Declaration
public static object GetProperty(this PropertyInfo propertyInfo, object obj)
Returns

System.Object

Parameters
TypeName
System.Reflection.PropertyInfopropertyInfo
System.Objectobj

SetValue(FieldInfo, PropertyInfo, Object, Object)

View Source
Declaration
public static void SetValue(FieldInfo fieldInfo, PropertyInfo propertyInfo, object obj, object value)
Parameters
TypeName
System.Reflection.FieldInfofieldInfo
System.Reflection.PropertyInfopropertyInfo
System.Objectobj
System.Objectvalue

IsUnsettableValue(FieldInfo, PropertyInfo)

View Source
Declaration
public static bool IsUnsettableValue(FieldInfo fieldInfo, PropertyInfo propertyInfo)
Returns

System.Boolean

Parameters
TypeName
System.Reflection.FieldInfofieldInfo
System.Reflection.PropertyInfopropertyInfo

CreateDefaultValues(IEnumerable<Type>, Dictionary<Type, Int32>)

View Source
Declaration
public static object[] CreateDefaultValues(IEnumerable<Type> types, Dictionary<Type, int> recursionInfo)
Returns

System.Object[]

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Type>types
System.Collections.Generic.Dictionary<System.Type,System.Int32>recursionInfo

CreateDefaultValue(Type, Dictionary<Type, Int32>)

View Source
Declaration
public static object CreateDefaultValue(Type type, Dictionary<Type, int> recursionInfo)
Returns

System.Object

Parameters
TypeName
System.Typetype
System.Collections.Generic.Dictionary<System.Type,System.Int32>recursionInfo

SetGenericCollection(Type, Object, Dictionary<Type, Int32>)

View Source
Declaration
public static void SetGenericCollection(Type realizedListType, object genericObj, Dictionary<Type, int> recursionInfo)
Parameters
TypeName
System.TyperealizedListType
System.ObjectgenericObj
System.Collections.Generic.Dictionary<System.Type,System.Int32>recursionInfo

PopulateArray(Type, Dictionary<Type, Int32>)

View Source
Declaration
public static Array PopulateArray(Type type, Dictionary<Type, int> recursionInfo)
Returns

System.Array

Parameters
TypeName
System.Typetype
System.Collections.Generic.Dictionary<System.Type,System.Int32>recursionInfo

CanCast(Type, Type)

View Source
Declaration
public static bool CanCast(Type toType, Type fromType)
Returns

System.Boolean

Parameters
TypeName
System.TypetoType
System.TypefromType

GetPropertyAttributes<T>(Type)

View Source
Declaration
public static IEnumerable<KeyValuePair<PropertyInfo, T>> GetPropertyAttributes<T>(Type fromType)
Returns

System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Reflection.PropertyInfo,<T>>>

Parameters
TypeName
System.TypefromType
Type Parameters
  • T

TryConvertCollections(Type, Type, Object)

View Source
Declaration
public static object TryConvertCollections(Type fromType, Type toType, object fromValue)
Returns

System.Object

Parameters
TypeName
System.TypefromType
System.TypetoType
System.ObjectfromValue