public SqlSugarClient(ConnectionConfig config) { base.Context = this; base.CurrentConnectionConfig = config; Check.ArgumentNullException(config, "config is null"); switch (config.DbType) { case DbType.MySql: DependencyManagement.TryMySqlData(); break; case DbType.SqlServer: break; case DbType.Sqlite: DependencyManagement.TrySqlite(); break; case DbType.Oracle: //throw new Exception("Oracle developed 75%,to be continued"); break; default: throw new Exception("ConnectionConfig.DbType is null"); } }
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; case DbType.Kdbndp: DependencyManagement.TryKdbndb(); break; case DbType.Dm: DependencyManagement.TryDm(); break; default: throw new Exception("ConnectionConfig.DbType is null"); } }
public SqlSugarClient(ConnectionConfig config) { this.Context = this; this.CurrentConnectionConfig = config; this.ContextID = Guid.NewGuid(); Console.WriteLine("sqlid:" + this.ContextID); Check.ArgumentNullException(config, "config is null"); 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 SqlSugarClient(ConnectionConfig config) { base.Context = this; base.CurrentConnectionConfig = config; base.ContextID = Guid.NewGuid(); Check.ArgumentNullException(config, "config is null"); 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: throw new Exception("Development 50%"); default: throw new Exception("ConnectionConfig.DbType is null"); } }
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; case DbType.Kdbndp: DependencyManagement.TryKdbndb(); break; case DbType.Dm: DependencyManagement.TryDm(); break; case DbType.Oscar: DependencyManagement.TryOscar(); break; case DbType.MySqlConnector: InstanceFactory.CustomDllName = SugarCompatible.IsFramework?"SqlSugar.MySqlConnector": "SqlSugar.MySqlConnectorCore"; break; case DbType.Access: InstanceFactory.CustomDllName = SugarCompatible.IsFramework?"SqlSugar.Access": "SqlSugar.AccessCore"; break; case DbType.Custom: Check.Exception(InstanceFactory.CustomDbName.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomDbName is not null "); Check.Exception(InstanceFactory.CustomNamespace.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomNamespace is not null "); Check.Exception(InstanceFactory.CustomDllName.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomDllName is not null "); 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)); }
/// <summary> /// Serialize Object /// </summary> /// <param name="value"></param> /// <returns></returns> public T DeserializeObject <T>(string value) { DependencyManagement.TryJsonNet(); return(JsonHelper.DeserializeObject <T>(value)); }
/// <summary> /// Serialize Object /// </summary> /// <param name="value"></param> /// <returns></returns> public string SerializeObject(object value) { DependencyManagement.TryJsonNet(); return(JsonHelper.SerializeObject(value)); }