mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 05:13:27 +08:00
Update .net core project
This commit is contained in:
parent
2648e403e6
commit
c33cd5d19f
@ -215,7 +215,8 @@ namespace SqlSugar
|
|||||||
FieldValue = String.Join(",", ids),
|
FieldValue = String.Join(",", ids),
|
||||||
CSharpTypeName = aColumn.PropertyInfo.PropertyType.Name
|
CSharpTypeName = aColumn.PropertyInfo.PropertyType.Name
|
||||||
}));
|
}));
|
||||||
var abids = this.Context.Queryable<object>().AS(mappingEntity.DbTableName).Where(conditionalModels).Select<SugarAbMapping>($"{aColumn.DbColumnName} as aid,{bColumn.DbColumnName} as bid").ToList();
|
var queryable = this.Context.Queryable<object>();
|
||||||
|
var abids = queryable.AS(mappingEntity.DbTableName).Where(conditionalModels).Select<SugarAbMapping>($"{queryable.SqlBuilder.GetTranslationColumnName(aColumn.DbColumnName)} as aid,{queryable.SqlBuilder.GetTranslationColumnName(bColumn.DbColumnName)} as bid").ToList();
|
||||||
|
|
||||||
List<IConditionalModel> conditionalModels2 = new List<IConditionalModel>();
|
List<IConditionalModel> conditionalModels2 = new List<IConditionalModel>();
|
||||||
conditionalModels2.Add((new ConditionalModel()
|
conditionalModels2.Add((new ConditionalModel()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
@ -440,7 +441,22 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
var oldDatabaseName = this.Context.Ado.Connection.Database;
|
var oldDatabaseName = this.Context.Ado.Connection.Database;
|
||||||
var connection = this.Context.CurrentConnectionConfig.ConnectionString;
|
var connection = this.Context.CurrentConnectionConfig.ConnectionString;
|
||||||
connection = connection.Replace(oldDatabaseName, "master");
|
if (Regex.Split(connection, oldDatabaseName).Length > 2)
|
||||||
|
{
|
||||||
|
var name=Regex.Match(connection, @"database\=\w+|datasource\=\w+",RegexOptions.IgnoreCase).Value;
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
connection = connection.Replace(name, "database=master");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Check.ExceptionEasy("Failed to create the database. The database name has a keyword. Please change the name", "建库失败,库名存在关键字,请换一个名字");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connection = connection.Replace(oldDatabaseName, "master");
|
||||||
|
}
|
||||||
var newDb = new SqlSugarClient(new ConnectionConfig()
|
var newDb = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = this.Context.CurrentConnectionConfig.DbType,
|
DbType = this.Context.CurrentConnectionConfig.DbType,
|
||||||
|
Loading…
Reference in New Issue
Block a user