/// <summary> /// 如果序列化对象出现异常 将创建新的对象 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> public static T GetRedis <T>(string key) { try { SoftwareConfig config = SoftwareConfig.FindConfig(key); T model = JObejctReflect.ToObejct <T>(config.Value); return(model); } catch { return(ReflectUtils.CreateObject <T>()); } }
public static ExportDataPageViewModel GetRedis() { SoftwareConfig config = SoftwareConfig.FindConfig(ExportDataPageRides); if (config != null) { ExportDataPageViewModel model = JObejctReflect.ToObejct <ExportDataPageViewModel>(config.Value); return(model); } else { return(new ExportDataPageViewModel()); } }
public static FileConfigPageViewModel GetRedis() { SoftwareConfig config = SoftwareConfig.FindConfig(FileConfigPageRides); if (config != null) { FileConfigPageViewModel model = JObejctReflect.ToObejct <FileConfigPageViewModel>(config.Value); if (!MyUtils.Utils.CheckFileExists(model.PhotoExcelPath)) { model.PhotoExcelPath = ""; } return(model); } else { return(new FileConfigPageViewModel()); } }