Support Create Database

This commit is contained in:
sunkaixuan 2019-05-17 20:34:53 +08:00
parent 03cb0e74f7
commit b5b19b7d4a
21 changed files with 287 additions and 112 deletions

View File

@ -15,11 +15,11 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString, ConnectionString = "server=.;uid=sa;pwd=haosql;database=MyDbBaseTest",
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true IsAutoCloseConnection = true
}); });
db.DbMaintenance.CreateDatabase();
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1 db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
Console.WriteLine("#### CodeFirst end ####"); Console.WriteLine("#### CodeFirst end ####");
} }

View File

@ -552,7 +552,7 @@ namespace SqlSugar
} }
public virtual List<T> SqlQuery<T>(string sql, params SugarParameter[] parameters) public virtual List<T> SqlQuery<T>(string sql, params SugarParameter[] parameters)
{ {
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
builder.SqlQueryBuilder.sql.Append(sql); builder.SqlQueryBuilder.sql.Append(sql);
if (parameters != null && parameters.Any()) if (parameters != null && parameters.Any())
@ -597,7 +597,7 @@ namespace SqlSugar
public Tuple<List<T>, List<T2>> SqlQuery<T, T2>(string sql, object parameters = null) public Tuple<List<T>, List<T2>> SqlQuery<T, T2>(string sql, object parameters = null)
{ {
var parsmeterArray = this.GetParameters(parameters); var parsmeterArray = this.GetParameters(parameters);
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
builder.SqlQueryBuilder.sql.Append(sql); builder.SqlQueryBuilder.sql.Append(sql);
if (parsmeterArray != null && parsmeterArray.Any()) if (parsmeterArray != null && parsmeterArray.Any())
@ -627,7 +627,7 @@ namespace SqlSugar
public Tuple<List<T>, List<T2>, List<T3>> SqlQuery<T, T2, T3>(string sql, object parameters = null) public Tuple<List<T>, List<T2>, List<T3>> SqlQuery<T, T2, T3>(string sql, object parameters = null)
{ {
var parsmeterArray = this.GetParameters(parameters); var parsmeterArray = this.GetParameters(parameters);
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
builder.SqlQueryBuilder.sql.Append(sql); builder.SqlQueryBuilder.sql.Append(sql);
if (parsmeterArray != null && parsmeterArray.Any()) if (parsmeterArray != null && parsmeterArray.Any())
@ -659,7 +659,7 @@ namespace SqlSugar
public Tuple<List<T>, List<T2>, List<T3>, List<T4>> SqlQuery<T, T2, T3, T4>(string sql, object parameters = null) public Tuple<List<T>, List<T2>, List<T3>, List<T4>> SqlQuery<T, T2, T3, T4>(string sql, object parameters = null)
{ {
var parsmeterArray = this.GetParameters(parameters); var parsmeterArray = this.GetParameters(parameters);
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
builder.SqlQueryBuilder.sql.Append(sql); builder.SqlQueryBuilder.sql.Append(sql);
if (parsmeterArray != null && parsmeterArray.Any()) if (parsmeterArray != null && parsmeterArray.Any())
@ -692,7 +692,7 @@ namespace SqlSugar
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>> SqlQuery<T, T2, T3, T4, T5>(string sql, object parameters = null) public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>> SqlQuery<T, T2, T3, T4, T5>(string sql, object parameters = null)
{ {
var parsmeterArray = this.GetParameters(parameters); var parsmeterArray = this.GetParameters(parameters);
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
builder.SqlQueryBuilder.sql.Append(sql); builder.SqlQueryBuilder.sql.Append(sql);
if (parsmeterArray != null && parsmeterArray.Any()) if (parsmeterArray != null && parsmeterArray.Any())
@ -728,7 +728,7 @@ namespace SqlSugar
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>> SqlQuery<T, T2, T3, T4, T5, T6>(string sql, object parameters = null) public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>> SqlQuery<T, T2, T3, T4, T5, T6>(string sql, object parameters = null)
{ {
var parsmeterArray = this.GetParameters(parameters); var parsmeterArray = this.GetParameters(parameters);
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
builder.SqlQueryBuilder.sql.Append(sql); builder.SqlQueryBuilder.sql.Append(sql);
if (parsmeterArray != null && parsmeterArray.Any()) if (parsmeterArray != null && parsmeterArray.Any())
@ -766,7 +766,7 @@ namespace SqlSugar
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>> SqlQuery<T, T2, T3, T4, T5, T6, T7>(string sql, object parameters = null) public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>> SqlQuery<T, T2, T3, T4, T5, T6, T7>(string sql, object parameters = null)
{ {
var parsmeterArray = this.GetParameters(parameters); var parsmeterArray = this.GetParameters(parameters);
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
builder.SqlQueryBuilder.sql.Append(sql); builder.SqlQueryBuilder.sql.Append(sql);
if (parsmeterArray != null && parsmeterArray.Any()) if (parsmeterArray != null && parsmeterArray.Any())

View File

@ -39,7 +39,7 @@ namespace SqlSugar
{ {
this.Context.Utilities.RemoveCacheAll(); this.Context.Utilities.RemoveCacheAll();
this.Context.InitMppingInfo(entityType); this.Context.InitMappingInfo(entityType);
if (!this.Context.DbMaintenance.IsAnySystemTablePermissions()) if (!this.Context.DbMaintenance.IsAnySystemTablePermissions())
{ {
Check.Exception(true, "Dbfirst and Codefirst requires system table permissions"); Check.Exception(true, "Dbfirst and Codefirst requires system table permissions");

View File

@ -101,7 +101,7 @@ namespace SqlSugar
LocalBuilder result = generator.DeclareLocal(type); LocalBuilder result = generator.DeclareLocal(type);
generator.Emit(OpCodes.Newobj, type.GetConstructor(Type.EmptyTypes)); generator.Emit(OpCodes.Newobj, type.GetConstructor(Type.EmptyTypes));
generator.Emit(OpCodes.Stloc, result); generator.Emit(OpCodes.Stloc, result);
this.Context.InitMppingInfo(type); this.Context.InitMappingInfo(type);
var columnInfos = this.Context.EntityMaintenance.GetEntityInfo(type).Columns; var columnInfos = this.Context.EntityMaintenance.GetEntityInfo(type).Columns;
foreach (var columnInfo in columnInfos) foreach (var columnInfo in columnInfos)
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -8,6 +9,10 @@ namespace SqlSugar
public abstract partial class DbMaintenanceProvider : IDbMaintenance public abstract partial class DbMaintenanceProvider : IDbMaintenance
{ {
#region DML #region DML
public virtual List<string> GetDataBaseList(SqlSugarClient db)
{
return db.Ado.SqlQuery<string>(this.GetDataBaseSql);
}
public virtual List<DbTableInfo> GetViewInfoList(bool isCache = true) public virtual List<DbTableInfo> GetViewInfoList(bool isCache = true)
{ {
string cacheKey = "DbMaintenanceProvider.GetViewInfoList"; string cacheKey = "DbMaintenanceProvider.GetViewInfoList";
@ -133,6 +138,37 @@ namespace SqlSugar
#endregion #endregion
#region DDL #region DDL
/// <summary>
///by current connection string
/// </summary>
/// <param name="databaseDirectory"></param>
/// <returns></returns>
public virtual bool CreateDatabase(string databaseDirectory = null)
{
var seChar = Path.DirectorySeparatorChar.ToString();
if (databaseDirectory == null)
{
databaseDirectory = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\').TrimEnd('/') +seChar+ "database";
}
else
{
databaseDirectory = databaseDirectory.TrimEnd('\\').TrimEnd('/');
}
var databaseName= this.Context.Ado.Connection.Database;
return CreateDatabase(databaseName,databaseDirectory);
}
/// <summary>
/// by databaseName
/// </summary>
/// <param name="databaseName"></param>
/// <param name="databaseDirectory"></param>
/// <returns></returns>
public virtual bool CreateDatabase(string databaseName, string databaseDirectory = null)
{
this.Context.Ado.ExecuteCommand(string.Format(CreateDataBaseSql, databaseName, databaseDirectory));
return true;
}
public virtual bool AddPrimaryKey(string tableName, string columnName) public virtual bool AddPrimaryKey(string tableName, string columnName)
{ {
tableName = this.SqlBuilder.GetTranslationTableName(tableName); tableName = this.SqlBuilder.GetTranslationTableName(tableName);
@ -174,7 +210,7 @@ namespace SqlSugar
public virtual bool TruncateTable<T>() public virtual bool TruncateTable<T>()
{ {
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
return this.TruncateTable(this.Context.EntityMaintenance.GetEntityInfo<T>().DbTableName); return this.TruncateTable(this.Context.EntityMaintenance.GetEntityInfo<T>().DbTableName);
} }
public virtual bool DropColumn(string tableName, string columnName) public virtual bool DropColumn(string tableName, string columnName)

View File

@ -26,11 +26,13 @@ namespace SqlSugar
#region DML #region DML
protected abstract string GetViewInfoListSql { get; } protected abstract string GetViewInfoListSql { get; }
protected abstract string GetDataBaseSql { get; }
protected abstract string GetTableInfoListSql { get; } protected abstract string GetTableInfoListSql { get; }
protected abstract string GetColumnInfosByTableNameSql { get; } protected abstract string GetColumnInfosByTableNameSql { get; }
#endregion #endregion
#region DDL #region DDL
protected abstract string CreateDataBaseSql { get; }
protected abstract string AddColumnToTableSql { get; } protected abstract string AddColumnToTableSql { get; }
protected abstract string AlterColumnToTableSql { get; } protected abstract string AlterColumnToTableSql { get; }
protected abstract string BackupDataBaseSql { get; } protected abstract string BackupDataBaseSql { get; }

View File

@ -972,7 +972,7 @@ namespace SqlSugar
protected ISugarQueryable<TResult> _Select<TResult>(Expression expression) protected ISugarQueryable<TResult> _Select<TResult>(Expression expression)
{ {
QueryBuilder.CheckExpression(expression, "Select"); QueryBuilder.CheckExpression(expression, "Select");
this.Context.InitMppingInfo(typeof(TResult)); this.Context.InitMappingInfo(typeof(TResult));
var result = InstanceFactory.GetQueryable<TResult>(this.Context.CurrentConnectionConfig); var result = InstanceFactory.GetQueryable<TResult>(this.Context.CurrentConnectionConfig);
result.Context = this.Context; result.Context = this.Context;
result.SqlBuilder = this.SqlBuilder; result.SqlBuilder = this.SqlBuilder;

View File

@ -13,13 +13,13 @@ namespace SqlSugar
{ {
this.saveObjects = saveObjects; this.saveObjects = saveObjects;
this.Context = context; this.Context = context;
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
} }
internal SaveableProvider(SqlSugarProvider context, T saveObject) internal SaveableProvider(SqlSugarProvider context, T saveObject)
{ {
this.saveObjects = new List<T>() { saveObject }; this.saveObjects = new List<T>() { saveObject };
this.Context = context; this.Context = context;
this.Context.InitMppingInfo<T>(); this.Context.InitMappingInfo<T>();
} }
public SqlSugarProvider Context { get; set; } public SqlSugarProvider Context { get; set; }
public List<T> saveObjects = new List<T>(); public List<T> saveObjects = new List<T>();

View File

@ -149,7 +149,7 @@ namespace SqlSugar
resolveExpress.MappingTables = Context.MappingTables; resolveExpress.MappingTables = Context.MappingTables;
resolveExpress.IgnoreComumnList = Context.IgnoreColumns; resolveExpress.IgnoreComumnList = Context.IgnoreColumns;
resolveExpress.SqlFuncServices = Context.CurrentConnectionConfig.ConfigureExternalServices == null ? null : Context.CurrentConnectionConfig.ConfigureExternalServices.SqlFuncServices; resolveExpress.SqlFuncServices = Context.CurrentConnectionConfig.ConfigureExternalServices == null ? null : Context.CurrentConnectionConfig.ConfigureExternalServices.SqlFuncServices;
resolveExpress.InitMappingInfo = Context.InitMppingInfo; resolveExpress.InitMappingInfo = Context.InitMappingInfo;
resolveExpress.RefreshMapping = () => resolveExpress.RefreshMapping = () =>
{ {
resolveExpress.MappingColumns = Context.MappingColumns; resolveExpress.MappingColumns = Context.MappingColumns;

View File

@ -225,7 +225,7 @@ namespace SqlSugar
resolveExpress.MappingTables = Context.MappingTables; resolveExpress.MappingTables = Context.MappingTables;
resolveExpress.IgnoreComumnList = Context.IgnoreColumns; resolveExpress.IgnoreComumnList = Context.IgnoreColumns;
resolveExpress.SqlFuncServices = Context.CurrentConnectionConfig.ConfigureExternalServices == null ? null : Context.CurrentConnectionConfig.ConfigureExternalServices.SqlFuncServices; resolveExpress.SqlFuncServices = Context.CurrentConnectionConfig.ConfigureExternalServices == null ? null : Context.CurrentConnectionConfig.ConfigureExternalServices.SqlFuncServices;
resolveExpress.InitMappingInfo = this.Context.InitMppingInfo; resolveExpress.InitMappingInfo = this.Context.InitMappingInfo;
resolveExpress.RefreshMapping = () => resolveExpress.RefreshMapping = () =>
{ {
resolveExpress.MappingColumns = Context.MappingColumns; resolveExpress.MappingColumns = Context.MappingColumns;

View File

@ -122,7 +122,7 @@ namespace SqlSugar
resolveExpress.IgnoreComumnList = Context.IgnoreColumns; resolveExpress.IgnoreComumnList = Context.IgnoreColumns;
resolveExpress.SqlFuncServices = Context.CurrentConnectionConfig.ConfigureExternalServices == null ? null : Context.CurrentConnectionConfig.ConfigureExternalServices.SqlFuncServices; resolveExpress.SqlFuncServices = Context.CurrentConnectionConfig.ConfigureExternalServices == null ? null : Context.CurrentConnectionConfig.ConfigureExternalServices.SqlFuncServices;
} }
resolveExpress.InitMappingInfo = Context.InitMppingInfo; resolveExpress.InitMappingInfo = Context.InitMappingInfo;
resolveExpress.RefreshMapping = () => resolveExpress.RefreshMapping = () =>
{ {
resolveExpress.MappingColumns = Context.MappingColumns; resolveExpress.MappingColumns = Context.MappingColumns;

View File

@ -71,71 +71,71 @@ namespace SqlSugar
} }
#endregion #endregion
#region Init mppingInfo #region Init mappingInfo
protected void InitMppingInfo<T, T2>() protected void InitMappingInfo<T, T2>()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
InitMppingInfo<T2>(); InitMappingInfo<T2>();
} }
protected void InitMppingInfo<T, T2, T3>() protected void InitMappingInfo<T, T2, T3>()
{ {
InitMppingInfo<T, T2>(); InitMappingInfo<T, T2>();
InitMppingInfo<T3>(); InitMappingInfo<T3>();
} }
protected void InitMppingInfo<T, T2, T3, T4>() protected void InitMappingInfo<T, T2, T3, T4>()
{ {
InitMppingInfo<T, T2, T3>(); InitMappingInfo<T, T2, T3>();
InitMppingInfo<T4>(); InitMappingInfo<T4>();
} }
protected void InitMppingInfo<T, T2, T3, T4, T5>() protected void InitMappingInfo<T, T2, T3, T4, T5>()
{ {
InitMppingInfo<T, T2, T3, T4>(); InitMappingInfo<T, T2, T3, T4>();
InitMppingInfo<T5>(); InitMappingInfo<T5>();
} }
protected void InitMppingInfo<T, T2, T3, T4, T5, T6>() protected void InitMappingInfo<T, T2, T3, T4, T5, T6>()
{ {
InitMppingInfo<T, T2, T3, T4, T5>(); InitMappingInfo<T, T2, T3, T4, T5>();
InitMppingInfo<T6>(); InitMappingInfo<T6>();
} }
protected void InitMppingInfo<T, T2, T3, T4, T5, T6, T7>() protected void InitMappingInfo<T, T2, T3, T4, T5, T6, T7>()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6>(); InitMappingInfo<T, T2, T3, T4, T5, T6>();
InitMppingInfo<T7>(); InitMappingInfo<T7>();
} }
protected void InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8>() protected void InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8>()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7>();
InitMppingInfo<T8>(); InitMappingInfo<T8>();
} }
#region 9-12 #region 9-12
protected void InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>() protected void InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8>();
InitMppingInfo<T9>(); InitMappingInfo<T9>();
} }
protected void InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>() protected void InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>();
InitMppingInfo<T10>(); InitMappingInfo<T10>();
} }
protected void InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>() protected void InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>();
InitMppingInfo<T11>(); InitMappingInfo<T11>();
} }
protected void InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>() protected void InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>();
InitMppingInfo<T12>(); InitMappingInfo<T12>();
} }
#endregion #endregion
public void InitMppingInfo<T>() public void InitMappingInfo<T>()
{ {
InitMppingInfo(typeof(T)); InitMappingInfo(typeof(T));
} }
public void InitMppingInfo(Type type) public void InitMappingInfo(Type type)
{ {
string cacheKey = "Context.InitAttributeMappingTables" + type.FullName; string cacheKey = "Context.InitAttributeMappingTables" + type.FullName;
var entityInfo = this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate<EntityInfo>(cacheKey, var entityInfo = this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate<EntityInfo>(cacheKey,
@ -145,7 +145,7 @@ namespace SqlSugar
return result; return result;
}); });
var copyObj = CopyEntityInfo(entityInfo); var copyObj = CopyEntityInfo(entityInfo);
InitMppingInfo(copyObj); InitMappingInfo(copyObj);
} }
private EntityInfo CopyEntityInfo(EntityInfo entityInfo) private EntityInfo CopyEntityInfo(EntityInfo entityInfo)
@ -188,7 +188,7 @@ namespace SqlSugar
return result; return result;
} }
private void InitMppingInfo(EntityInfo entityInfo) private void InitMappingInfo(EntityInfo entityInfo)
{ {
if (this.MappingTables == null) if (this.MappingTables == null)
this.MappingTables = new MappingTableList(); this.MappingTables = new MappingTableList();

View File

@ -91,7 +91,7 @@ namespace SqlSugar
public virtual ISugarQueryable<T> Queryable<T>() public virtual ISugarQueryable<T> Queryable<T>()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
var result = this.CreateQueryable<T>(); var result = this.CreateQueryable<T>();
return result; return result;
} }
@ -117,7 +117,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2> Queryable<T, T2>(Expression<Func<T, T2, object[]>> joinExpression) public virtual ISugarQueryable<T, T2> Queryable<T, T2>(Expression<Func<T, T2, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2>(); InitMappingInfo<T, T2>();
var types = new Type[] { typeof(T2) }; var types = new Type[] { typeof(T2) };
var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -125,7 +125,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2> Queryable<T, T2>(Expression<Func<T, T2, JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2> Queryable<T, T2>(Expression<Func<T, T2, JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2>(); InitMappingInfo<T, T2>();
var types = new Type[] { typeof(T2) }; var types = new Type[] { typeof(T2) };
var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -133,7 +133,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3>(); InitMappingInfo<T, T2, T3>();
var types = new Type[] { typeof(T2), typeof(T3) }; var types = new Type[] { typeof(T2), typeof(T3) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -141,7 +141,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3,JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3,JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3>(); InitMappingInfo<T, T2, T3>();
var types = new Type[] { typeof(T2), typeof(T3) }; var types = new Type[] { typeof(T2), typeof(T3) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -149,7 +149,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4>(); InitMappingInfo<T, T2, T3, T4>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -157,7 +157,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4,JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4,JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4>(); InitMappingInfo<T, T2, T3, T4>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -165,7 +165,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5>(); InitMappingInfo<T, T2, T3, T4, T5>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -173,7 +173,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5,JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5,JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5>(); InitMappingInfo<T, T2, T3, T4, T5>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -181,7 +181,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6> Queryable<T, T2, T3, T4, T5, T6>(Expression<Func<T, T2, T3, T4, T5, T6, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6> Queryable<T, T2, T3, T4, T5, T6>(Expression<Func<T, T2, T3, T4, T5, T6, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6>(); InitMappingInfo<T, T2, T3, T4, T5, T6>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -189,7 +189,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6> Queryable<T, T2, T3, T4, T5, T6>(Expression<Func<T, T2, T3, T4, T5, T6, JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6> Queryable<T, T2, T3, T4, T5, T6>(Expression<Func<T, T2, T3, T4, T5, T6, JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6>(); InitMappingInfo<T, T2, T3, T4, T5, T6>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -197,7 +197,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Queryable<T, T2, T3, T4, T5, T6, T7>(Expression<Func<T, T2, T3, T4, T5, T6, T7, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Queryable<T, T2, T3, T4, T5, T6, T7>(Expression<Func<T, T2, T3, T4, T5, T6, T7, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -205,7 +205,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Queryable<T, T2, T3, T4, T5, T6, T7>(Expression<Func<T, T2, T3, T4, T5, T6, T7, JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Queryable<T, T2, T3, T4, T5, T6, T7>(Expression<Func<T, T2, T3, T4, T5, T6, T7, JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -213,7 +213,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -221,7 +221,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -230,7 +230,7 @@ namespace SqlSugar
#region 9-12 #region 9-12
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -238,7 +238,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -246,7 +246,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -254,7 +254,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -262,7 +262,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -270,7 +270,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -278,7 +278,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, object[]>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, object[]>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -286,7 +286,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, JoinQueryInfos>> joinExpression) public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, JoinQueryInfos>> joinExpression)
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this.CurrentConnectionConfig);
this.CreateQueryJoin(joinExpression, types, queryable); this.CreateQueryJoin(joinExpression, types, queryable);
@ -295,7 +295,7 @@ namespace SqlSugar
#endregion #endregion
public virtual ISugarQueryable<T, T2> Queryable<T, T2>(Expression<Func<T, T2, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2> Queryable<T, T2>(Expression<Func<T, T2, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2>(); InitMappingInfo<T, T2>();
var types = new Type[] { typeof(T2) }; var types = new Type[] { typeof(T2) };
var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -304,7 +304,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3>(); InitMappingInfo<T, T2, T3>();
var types = new Type[] { typeof(T2), typeof(T3) }; var types = new Type[] { typeof(T2), typeof(T3) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -313,7 +313,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4>(); InitMappingInfo<T, T2, T3, T4>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -322,7 +322,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5>(); InitMappingInfo<T, T2, T3, T4, T5>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -331,7 +331,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6> Queryable<T, T2, T3, T4, T5, T6>(Expression<Func<T, T2, T3, T4, T5, T6, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5, T6> Queryable<T, T2, T3, T4, T5, T6>(Expression<Func<T, T2, T3, T4, T5, T6, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6>(); InitMappingInfo<T, T2, T3, T4, T5, T6>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -340,7 +340,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Queryable<T, T2, T3, T4, T5, T6, T7>(Expression<Func<T, T2, T3, T4, T5, T6, T7, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7> Queryable<T, T2, T3, T4, T5, T6, T7>(Expression<Func<T, T2, T3, T4, T5, T6, T7, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -349,7 +349,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -360,7 +360,7 @@ namespace SqlSugar
#region 9-12 #region 9-12
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -369,7 +369,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -378,7 +378,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -387,7 +387,7 @@ namespace SqlSugar
} }
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>> joinExpression) where T : class, new() public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool>> joinExpression) where T : class, new()
{ {
InitMppingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(); InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>();
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }; var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) };
var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this.CurrentConnectionConfig);
this.CreateEasyQueryJoin(joinExpression, types, queryable); this.CreateEasyQueryJoin(joinExpression, types, queryable);
@ -413,7 +413,7 @@ namespace SqlSugar
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
sqlBuilder.Context = this; sqlBuilder.Context = this;
InitMppingInfo<T, T2>(); InitMappingInfo<T, T2>();
var types = new Type[] { typeof(T2) }; var types = new Type[] { typeof(T2) };
var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig); var queryable = InstanceFactory.GetQueryable<T, T2>(this.CurrentConnectionConfig);
queryable.Context = this.Context; queryable.Context = this.Context;
@ -515,7 +515,7 @@ namespace SqlSugar
#region Insertable #region Insertable
public virtual IInsertable<T> Insertable<T>(T[] insertObjs) where T : class, new() public virtual IInsertable<T> Insertable<T>(T[] insertObjs) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
InsertableProvider<T> result = this.CreateInsertable(insertObjs); InsertableProvider<T> result = this.CreateInsertable(insertObjs);
return result; return result;
} }
@ -534,7 +534,7 @@ namespace SqlSugar
} }
public virtual IInsertable<T> Insertable<T>(Dictionary<string, object> columnDictionary) where T : class, new() public virtual IInsertable<T> Insertable<T>(Dictionary<string, object> columnDictionary) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Insertable.columnDictionary can't be null"); Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Insertable.columnDictionary can't be null");
var insertObject = this.Context.Utilities.DeserializeObject<T>(this.Context.Utilities.SerializeObject(columnDictionary)); var insertObject = this.Context.Utilities.DeserializeObject<T>(this.Context.Utilities.SerializeObject(columnDictionary));
var columns = columnDictionary.Select(it => it.Key).ToList(); var columns = columnDictionary.Select(it => it.Key).ToList();
@ -542,7 +542,7 @@ namespace SqlSugar
} }
public virtual IInsertable<T> Insertable<T>(dynamic insertDynamicObject) where T : class, new() public virtual IInsertable<T> Insertable<T>(dynamic insertDynamicObject) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
if (insertDynamicObject is T) if (insertDynamicObject is T)
{ {
return this.Context.Insertable((T)insertDynamicObject); return this.Context.Insertable((T)insertDynamicObject);
@ -560,38 +560,38 @@ namespace SqlSugar
#region Deleteable #region Deleteable
public virtual IDeleteable<T> Deleteable<T>() where T : class, new() public virtual IDeleteable<T> Deleteable<T>() where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
DeleteableProvider<T> result = this.CreateDeleteable<T>(); DeleteableProvider<T> result = this.CreateDeleteable<T>();
return result; return result;
} }
public virtual IDeleteable<T> Deleteable<T>(Expression<Func<T, bool>> expression) where T : class, new() public virtual IDeleteable<T> Deleteable<T>(Expression<Func<T, bool>> expression) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
return this.Context.Deleteable<T>().Where(expression); return this.Context.Deleteable<T>().Where(expression);
} }
public virtual IDeleteable<T> Deleteable<T>(dynamic primaryKeyValue) where T : class, new() public virtual IDeleteable<T> Deleteable<T>(dynamic primaryKeyValue) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
return this.Context.Deleteable<T>().In(primaryKeyValue); return this.Context.Deleteable<T>().In(primaryKeyValue);
} }
public virtual IDeleteable<T> Deleteable<T>(dynamic[] primaryKeyValues) where T : class, new() public virtual IDeleteable<T> Deleteable<T>(dynamic[] primaryKeyValues) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
return this.Context.Deleteable<T>().In(primaryKeyValues); return this.Context.Deleteable<T>().In(primaryKeyValues);
} }
public virtual IDeleteable<T> Deleteable<T>(List<dynamic> pkValue) where T : class, new() public virtual IDeleteable<T> Deleteable<T>(List<dynamic> pkValue) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
return this.Context.Deleteable<T>().In(pkValue); return this.Context.Deleteable<T>().In(pkValue);
} }
public virtual IDeleteable<T> Deleteable<T>(T deleteObj) where T : class, new() public virtual IDeleteable<T> Deleteable<T>(T deleteObj) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
return this.Context.Deleteable<T>().Where(deleteObj); return this.Context.Deleteable<T>().Where(deleteObj);
} }
public virtual IDeleteable<T> Deleteable<T>(List<T> deleteObjs) where T : class, new() public virtual IDeleteable<T> Deleteable<T>(List<T> deleteObjs) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
return this.Context.Deleteable<T>().Where(deleteObjs); return this.Context.Deleteable<T>().Where(deleteObjs);
} }
#endregion #endregion
@ -599,7 +599,7 @@ namespace SqlSugar
#region Updateable #region Updateable
public virtual IUpdateable<T> Updateable<T>(T[] UpdateObjs) where T : class, new() public virtual IUpdateable<T> Updateable<T>(T[] UpdateObjs) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
UpdateableProvider<T> result = this.CreateUpdateable(UpdateObjs); UpdateableProvider<T> result = this.CreateUpdateable(UpdateObjs);
return result; return result;
} }
@ -634,7 +634,7 @@ namespace SqlSugar
public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new() public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Updateable.columnDictionary can't be null"); Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Updateable.columnDictionary can't be null");
var updateObject = this.Context.Utilities.DeserializeObject<T>(this.Context.Utilities.SerializeObject(columnDictionary)); var updateObject = this.Context.Utilities.DeserializeObject<T>(this.Context.Utilities.SerializeObject(columnDictionary));
var columns = columnDictionary.Select(it => it.Key).ToList(); var columns = columnDictionary.Select(it => it.Key).ToList();
@ -642,7 +642,7 @@ namespace SqlSugar
} }
public virtual IUpdateable<T> Updateable<T>(dynamic updateDynamicObject) where T : class, new() public virtual IUpdateable<T> Updateable<T>(dynamic updateDynamicObject) where T : class, new()
{ {
InitMppingInfo<T>(); InitMappingInfo<T>();
if (updateDynamicObject is T) if (updateDynamicObject is T)
{ {
return this.Context.Updateable((T)updateDynamicObject); return this.Context.Updateable((T)updateDynamicObject);

View File

@ -47,6 +47,20 @@ namespace SqlSugar
bool DeleteTableRemark(string tableName); bool DeleteTableRemark(string tableName);
bool IsAnyTableRemark(string tableName); bool IsAnyTableRemark(string tableName);
bool RenameTable(string oldTableName,string newTableName); bool RenameTable(string oldTableName,string newTableName);
/// <summary>
///by current connection string
/// </summary>
/// <param name="databaseDirectory"></param>
/// <returns></returns>
bool CreateDatabase(string databaseDirectory = null);
/// <summary>
/// by databaseName
/// </summary>
/// <param name="databaseName"></param>
/// <param name="databaseDirectory"></param>
/// <returns></returns>
bool CreateDatabase(string databaseName,string databaseDirectory = null);
List<string> GetDataBaseList(SqlSugarClient db);
#endregion #endregion
} }
} }

View File

@ -46,8 +46,8 @@ namespace SqlSugar
DateTime GetDate(); DateTime GetDate();
SimpleClient GetSimpleClient(); SimpleClient GetSimpleClient();
SimpleClient<T> GetSimpleClient<T>() where T : class, new(); SimpleClient<T> GetSimpleClient<T>() where T : class, new();
void InitMppingInfo(Type type); void InitMappingInfo(Type type);
void InitMppingInfo<T>(); void InitMappingInfo<T>();
void Open(); void Open();
void Close(); void Close();
#endregion #endregion

View File

@ -8,6 +8,13 @@ namespace SqlSugar
public class MySqlDbMaintenance : DbMaintenanceProvider public class MySqlDbMaintenance : DbMaintenanceProvider
{ {
#region DML #region DML
protected override string GetDataBaseSql
{
get
{
return "SELECT NAME FROM MASTER.DBO.SYSDATABASES ORDER BY NAME";
}
}
protected override string GetColumnInfosByTableNameSql protected override string GetColumnInfosByTableNameSql
{ {
get get
@ -50,6 +57,13 @@ namespace SqlSugar
#endregion #endregion
#region DDL #region DDL
protected override string CreateDataBaseSql
{
get
{
return "CREATE DATABASE {0}";
}
}
protected override string AddPrimaryKeySql protected override string AddPrimaryKeySql
{ {
get get

View File

@ -10,6 +10,13 @@ namespace SqlSugar
public class OracleDbMaintenance : DbMaintenanceProvider public class OracleDbMaintenance : DbMaintenanceProvider
{ {
#region DML #region DML
protected override string GetDataBaseSql
{
get
{
return "";
}
}
protected override string GetColumnInfosByTableNameSql protected override string GetColumnInfosByTableNameSql
{ {
get get
@ -44,6 +51,13 @@ namespace SqlSugar
#endregion #endregion
#region DDL #region DDL
protected override string CreateDataBaseSql
{
get
{
return "CREATE DATABASE {0}";
}
}
protected override string AddPrimaryKeySql protected override string AddPrimaryKeySql
{ {
get get

View File

@ -8,6 +8,13 @@ namespace SqlSugar
public class PostgreSQLDbMaintenance : DbMaintenanceProvider public class PostgreSQLDbMaintenance : DbMaintenanceProvider
{ {
#region DML #region DML
protected override string GetDataBaseSql
{
get
{
return "";
}
}
protected override string GetColumnInfosByTableNameSql protected override string GetColumnInfosByTableNameSql
{ {
get get
@ -62,6 +69,13 @@ namespace SqlSugar
#endregion #endregion
#region DDL #region DDL
protected override string CreateDataBaseSql
{
get
{
return "CREATE DATABASE {0}";
}
}
protected override string AddPrimaryKeySql protected override string AddPrimaryKeySql
{ {
get get
@ -201,6 +215,7 @@ namespace SqlSugar
protected override string IsAnyTableRemarkSql => throw new NotSupportedException(); protected override string IsAnyTableRemarkSql => throw new NotSupportedException();
protected override string RenameTableSql => "alter table 表名 {0} to {1}"; protected override string RenameTableSql => "alter table 表名 {0} to {1}";
#endregion #endregion
#region Methods #region Methods

View File

@ -8,6 +8,13 @@ namespace SqlSugar
public class SqlServerDbMaintenance : DbMaintenanceProvider public class SqlServerDbMaintenance : DbMaintenanceProvider
{ {
#region DML #region DML
protected override string GetDataBaseSql
{
get
{
return "SELECT NAME FROM MASTER.DBO.SYSDATABASES ORDER BY NAME";
}
}
protected override string GetColumnInfosByTableNameSql protected override string GetColumnInfosByTableNameSql
{ {
get get
@ -75,6 +82,37 @@ namespace SqlSugar
#endregion #endregion
#region DDL #region DDL
protected override string CreateDataBaseSql
{
get
{
return @"
create database {0}
on primary
(
name = N'{0}',
filename=N'{1}\{0}.mdf',
size=10mb,
maxsize=100mb,
filegrowth=1mb
),
(
name=N'{0}_ndf',
filename=N'{1}\{0}.ndf',
size=10mb,
maxsize=100mb,
filegrowth=10%
)
log on --
(
name=N'{0}_log',
filename=N'{1}\{0}.ldf',
size=100mb,
maxsize=1gb,
filegrowth=10mb
);";
}
}
protected override string AddPrimaryKeySql protected override string AddPrimaryKeySql
{ {
get get
@ -272,8 +310,36 @@ namespace SqlSugar
return "EXEC sp_rename '{0}','{1}'"; return "EXEC sp_rename '{0}','{1}'";
} }
} }
#endregion
#endregion
/// <summary>
///by current connection string
/// </summary>
/// <param name="databaseDirectory"></param>
/// <returns></returns>
public override bool CreateDatabase(string databaseName, string databaseDirectory = null)
{
if (databaseDirectory != null)
{
if (!FileHelper.IsExistDirectory(databaseDirectory))
{
FileHelper.CreateDirectory(databaseDirectory);
}
}
var oldDatabaseName = this.Context.Ado.Connection.Database;
var connection = this.Context.CurrentConnectionConfig.ConnectionString;
connection = connection.Replace(oldDatabaseName, "master");
var newDb = new SqlSugarClient(new ConnectionConfig() {
DbType = this.Context.CurrentConnectionConfig.DbType,
IsAutoCloseConnection = true,
ConnectionString = connection
});
if (!GetDataBaseList(newDb).Any(it => it.Equals(databaseName, StringComparison.CurrentCultureIgnoreCase)))
{
newDb.Ado.ExecuteCommand(string.Format(CreateDataBaseSql, databaseName, databaseDirectory));
}
return true;
}
public override bool CreateTable(string tableName, List<DbColumnInfo> columns, bool isCreatePrimaryKey = true) public override bool CreateTable(string tableName, List<DbColumnInfo> columns, bool isCreatePrimaryKey = true)
{ {
tableName = this.SqlBuilder.GetTranslationTableName(tableName); tableName = this.SqlBuilder.GetTranslationTableName(tableName);

View File

@ -11,6 +11,13 @@ namespace SqlSugar
public class SqliteDbMaintenance : DbMaintenanceProvider public class SqliteDbMaintenance : DbMaintenanceProvider
{ {
#region DML #region DML
protected override string GetDataBaseSql
{
get
{
return "";
}
}
protected override string GetColumnInfosByTableNameSql protected override string GetColumnInfosByTableNameSql
{ {
get get
@ -35,6 +42,13 @@ namespace SqlSugar
#endregion #endregion
#region DDL #region DDL
protected override string CreateDataBaseSql
{
get
{
return "CREATE DATABASE {0}";
}
}
protected override string AddPrimaryKeySql protected override string AddPrimaryKeySql
{ {
get get

View File

@ -658,13 +658,13 @@ namespace SqlSugar
{ {
return this.Context.GetDate(); return this.Context.GetDate();
} }
public void InitMppingInfo(Type type) public void InitMappingInfo(Type type)
{ {
this.Context.InitMppingInfo(type); this.Context.InitMappingInfo(type);
} }
public void InitMppingInfo<T>() public void InitMappingInfo<T>()
{ {
this.Context.InitMppingInfo(typeof(T)); this.Context.InitMappingInfo(typeof(T));
} }
#endregion #endregion