public object Deserialize(Type objectType, DTObject dto) { if (objectType == typeof(DTObject)) { return(dto); } TypeMakupInfo typeInfo = TypeMakupInfo.GetTypeInfo(objectType); return(typeInfo.Deserialize(dto)); }
public T Deserialize <T>(DTObject obj) { var targetType = typeof(T); if (targetType == typeof(DTObject)) { return((T)((object)obj)); } TypeMakupInfo typeInfo = TypeMakupInfo.GetTypeInfo(targetType); return((T)typeInfo.Deserialize(obj)); }
/// <summary> /// 将dto的内容反序列化到<paramref name="instance"/> /// </summary> /// <param name="instance"></param> /// <param name="dto"></param> public void Deserialize(object instance, DTObject dto) { TypeMakupInfo typeInfo = TypeMakupInfo.GetTypeInfo(instance.GetType()); typeInfo.Deserialize(instance, dto); }