private static void CheckDbDependency(ConnectionConfig config) { switch (config.DbType) { case DbType.MySql: DependencyManagement.TryMySqlData(); break; case DbType.SqlServer: break; case DbType.Sqlite: DependencyManagement.TrySqlite(); break; case DbType.Oracle: DependencyManagement.TryOracle(); break; case DbType.PostgreSQL: DependencyManagement.TryPostgreSQL(); break; default: throw new Exception("ConnectionConfig.DbType is null"); } }
public string SerializeObject(object value, Type type) { DependencyManagement.TryJsonNet(); if (type.IsAnonymousType()) { return(Context.CurrentConnectionConfig.ConfigureExternalServices.SerializeService.SerializeObject(value)); } else { var isSugar = this.Context.EntityMaintenance.GetEntityInfo(type).Columns.Any(it => it.NoSerialize || it.SerializeDateTimeFormat.HasValue()); if (isSugar) { return(Context.CurrentConnectionConfig.ConfigureExternalServices.SerializeService.SugarSerializeObject(value)); } else { return(Context.CurrentConnectionConfig.ConfigureExternalServices.SerializeService.SerializeObject(value)); } } }
/// <summary> /// Serialize Object /// </summary> /// <param name="value"></param> /// <returns></returns> public T DeserializeObject <T>(string value) { DependencyManagement.TryJsonNet(); return(Context.CurrentConnectionConfig.ConfigureExternalServices.SerializeService.DeserializeObject <T>(value)); }