mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-03 04:36:03 +08:00
Feature:Asynchronous Operation & Formatting Code
- Now the async operation is enabled! - Code formatted by Resharper plugin <3
This commit is contained in:
@@ -1,38 +1,32 @@
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Database
|
||||
namespace EggLink.DanhengServer.Database;
|
||||
|
||||
public class CustomSerializeService : ISerializeService
|
||||
{
|
||||
public class CustomSerializeService : ISerializeService
|
||||
private readonly JsonSerializerSettings _jsonSettings;
|
||||
|
||||
public CustomSerializeService()
|
||||
{
|
||||
private JsonSerializerSettings _jsonSettings;
|
||||
|
||||
public CustomSerializeService()
|
||||
_jsonSettings = new JsonSerializerSettings
|
||||
{
|
||||
_jsonSettings = new JsonSerializerSettings
|
||||
{
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore // ignore default values
|
||||
};
|
||||
}
|
||||
|
||||
public string SerializeObject(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value, _jsonSettings);
|
||||
}
|
||||
|
||||
public T DeserializeObject<T>(string value)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(value)!;
|
||||
}
|
||||
|
||||
public string SugarSerializeObject(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value, _jsonSettings);
|
||||
}
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore // ignore default values
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public string SerializeObject(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value, _jsonSettings);
|
||||
}
|
||||
|
||||
public T DeserializeObject<T>(string value)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(value)!;
|
||||
}
|
||||
|
||||
public string SugarSerializeObject(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value, _jsonSettings);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user