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
Type | Name |
---|---|
System.Type | fromType |
System.Type | toType |
GetConverter(Type, Type)
View Source
Declaration
public static GetMemberDelegate GetConverter(Type fromType, Type toType)
Returns
ServiceStack.GetMemberDelegate
Parameters
Type | Name |
---|---|
System.Type | fromType |
System.Type | toType |
GetPopulator(Type, Type)
View Source
Declaration
public static PopulateMemberDelegate GetPopulator(Type targetType, Type sourceType)
Returns
ServiceStack.PopulateMemberDelegate
Parameters
Type | Name |
---|---|
System.Type | targetType |
System.Type | sourceType |
ConvertTo<T>(Object, T)
View Source
Declaration
public static T ConvertTo<T>(this object from, T defaultValue)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Object | from |
<T> | defaultValue |
Type Parameters
T
ConvertTo<T>(Object)
View Source
Declaration
public static T ConvertTo<T>(this object from)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Object | from |
Type Parameters
T
ConvertTo<T>(Object, Boolean)
View Source
Declaration
public static T ConvertTo<T>(this object from, bool skipConverters)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Object | from |
System.Boolean | skipConverters |
Type Parameters
T
CreateCopy<T>(T)
View Source
Declaration
public static T CreateCopy<T>(this T from)
Returns
<T>
Parameters
Type | Name |
---|---|
<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
Type | Name |
---|---|
<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
Type | Name |
---|---|
System.Object | from |
System.Type | toType |
ConvertTo(Object, Type, Boolean)
View Source
Declaration
public static object ConvertTo(this object from, Type toType, bool skipConverters)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | from |
System.Type | toType |
System.Boolean | skipConverters |
GetImplicitCastMethod(Type, Type)
View Source
Declaration
public static MethodInfo GetImplicitCastMethod(Type fromType, Type toType)
Returns
System.Reflection.MethodInfo
Parameters
Type | Name |
---|---|
System.Type | fromType |
System.Type | toType |
GetExplicitCastMethod(Type, Type)
View Source
Declaration
public static MethodInfo GetExplicitCastMethod(Type fromType, Type toType)
Returns
System.Reflection.MethodInfo
Parameters
Type | Name |
---|---|
System.Type | fromType |
System.Type | toType |
ChangeValueType(Object, Type)
View Source
Declaration
public static object ChangeValueType(object from, Type toType)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | from |
System.Type | toType |
ChangeTo(String, Type)
View Source
Declaration
public static object ChangeTo(this string strValue, Type type)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | strValue |
System.Type | type |
GetPropertyNames(Type)
View Source
Declaration
public static List<string> GetPropertyNames(this Type type)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.Type | type |
GetAssemblyPath(Type)
View Source
Declaration
public static string GetAssemblyPath(this Type source)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | source |
IsDebugBuild(Assembly)
View Source
Declaration
public static bool IsDebugBuild(this Assembly assembly)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Reflection.Assembly | assembly |
PopulateWith(Object)
Populate an object with Example data.
View Source
Declaration
public static object PopulateWith(object obj)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | obj |
GetDefaultValue(Type)
View Source
Declaration
public static object GetDefaultValue(this Type type)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Type | type |
IsDefaultValue(Object)
View Source
Declaration
public static bool IsDefaultValue(object value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Object | value |
IsDefaultValue(Object, Type)
View Source
Declaration
public static bool IsDefaultValue(object value, Type valueType)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Object | value |
System.Type | valueType |
PopulateWith<To, From>(To, From)
View Source
Declaration
public static To PopulateWith<To, From>(this To to, From from)
Returns
<To>
Parameters
Type | Name |
---|---|
<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
Type | Name |
---|---|
<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
Type | Name |
---|---|
<To> | to |
<From> | from |
System.Type | attributeType |
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
Type | Name |
---|---|
<To> | to |
<From> | from |
System.Type | attributeType |
Type Parameters
To
From
SetProperty(PropertyInfo, Object, Object)
View Source
Declaration
public static void SetProperty(this PropertyInfo propertyInfo, object obj, object value)
Parameters
Type | Name |
---|---|
System.Reflection.PropertyInfo | propertyInfo |
System.Object | obj |
System.Object | value |
GetProperty(PropertyInfo, Object)
View Source
Declaration
public static object GetProperty(this PropertyInfo propertyInfo, object obj)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Reflection.PropertyInfo | propertyInfo |
System.Object | obj |
SetValue(FieldInfo, PropertyInfo, Object, Object)
View Source
Declaration
public static void SetValue(FieldInfo fieldInfo, PropertyInfo propertyInfo, object obj, object value)
Parameters
Type | Name |
---|---|
System.Reflection.FieldInfo | fieldInfo |
System.Reflection.PropertyInfo | propertyInfo |
System.Object | obj |
System.Object | value |
IsUnsettableValue(FieldInfo, PropertyInfo)
View Source
Declaration
public static bool IsUnsettableValue(FieldInfo fieldInfo, PropertyInfo propertyInfo)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Reflection.FieldInfo | fieldInfo |
System.Reflection.PropertyInfo | propertyInfo |
CreateDefaultValues(IEnumerable<Type>, Dictionary<Type, Int32>)
View Source
Declaration
public static object[] CreateDefaultValues(IEnumerable<Type> types, Dictionary<Type, int> recursionInfo)
Returns
System.Object[]
Parameters
Type | Name |
---|---|
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
Type | Name |
---|---|
System.Type | type |
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
Type | Name |
---|---|
System.Type | realizedListType |
System.Object | genericObj |
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
Type | Name |
---|---|
System.Type | type |
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
Type | Name |
---|---|
System.Type | toType |
System.Type | fromType |
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
Type | Name |
---|---|
System.Type | fromType |
Type Parameters
T
TryConvertCollections(Type, Type, Object)
View Source
Declaration
public static object TryConvertCollections(Type fromType, Type toType, object fromValue)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Type | fromType |
System.Type | toType |
System.Object | fromValue |