1.修复多账套对接时报工切换账套不生效(严重bug)
2.切换底层逻辑,增加外部增加数据源的接口 3.增加缓存,减少频繁登录导致可能存在的突发数据库连接异常
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.Json
|
||||
{
|
||||
public static class JsonHelper
|
||||
{
|
||||
public static object ToJson(this string Json)
|
||||
{
|
||||
return Json == null ? null : JsonConvert.DeserializeObject(Json);
|
||||
}
|
||||
public static string ToJson(this object obj)
|
||||
{
|
||||
var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
|
||||
return JsonConvert.SerializeObject(obj, timeConverter);
|
||||
}
|
||||
|
||||
public static string ToJson(this object obj, string datetimeformats)
|
||||
{
|
||||
var timeConverter = new IsoDateTimeConverter { DateTimeFormat = datetimeformats };
|
||||
return JsonConvert.SerializeObject(obj, timeConverter);
|
||||
}
|
||||
public static T ToObject<T>(this string Json)
|
||||
{
|
||||
return Json == null ? default : JsonConvert.DeserializeObject<T>(Json);
|
||||
}
|
||||
public static List<T> ToList<T>(this string Json)
|
||||
{
|
||||
return Json == null ? null : JsonConvert.DeserializeObject<List<T>>(Json);
|
||||
}
|
||||
public static DataTable ToTable(this string Json)
|
||||
{
|
||||
return Json == null ? null : JsonConvert.DeserializeObject<DataTable>(Json);
|
||||
}
|
||||
public static JObject ToJObject(this string Json)
|
||||
{
|
||||
return JObject.Parse(Json.Replace(" ", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user