using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; using ServerCore; namespace ServerBase; public partial class RedisConnector : RedisConnectorBase, IModule, IInitializer { public class ConfigParam : IConfigParam { public string ServiceType { get; set; } = string.Empty; public string ConnectionString { get; set; } = string.Empty; public Result tryReadFromJsonOrDefault(JObject jObject) { var result = new Result(); var err_msg = string.Empty; try { ServiceType = jObject["ServiceType"]?.Value() ?? string.Empty; ConnectionString = jObject["Redis"]?.Value() ?? string.Empty; return result; } catch (Exception e) { var error_code = ServerErrorCode.TryCatchException; err_msg = $"Exception !!!, Failed to perform in tryReadFromJsonOrDefault() !!! : errorCode:{error_code}, exception:{e} - {this.getTypeName()}"; result.setFail(error_code, err_msg); Log.getLogger().error(err_msg); return result; } } public string toBasicString() { return $"ConfigParam: ServiceType:{ServiceType}, ConnectionStringOfRedis:{ConnectionString}"; } }; }