/// <summary> /// 根据架构代码,将dto的数据创建到新实例<paramref name="instanceType"/>中 /// </summary> /// <param name="schemaCode"></param> /// <param name="instanceType"></param> /// <returns></returns> public object Save(Type instanceType, string schemaCode, DTObject dto) { if (instanceType == typeof(DTObject)) { return(dto.Clone()); } TypeSchemaCodeInfo typeInfo = TypeSchemaCodeInfo.GetTypeInfo(instanceType, schemaCode); return(typeInfo.Deserialize(dto)); }
/// <summary> /// 根据架构代码,将dto的数据写入到新实例<paramref name="instanceType"/>中 /// </summary> /// <param name="instance"></param> /// <param name="schemaCode"></param> /// <param name="dto"></param> public void Save(object instance, string schemaCode, DTObject dto) { //if (instance.IsNull()) return; var instanceType = instance.GetType(); if (instanceType == typeof(DTObject)) { instance = dto.Clone(); } TypeSchemaCodeInfo typeInfo = TypeSchemaCodeInfo.GetTypeInfo(instanceType, schemaCode); typeInfo.Deserialize(instance, dto); }