Update Core

This commit is contained in:
sunkaixuan
2017-07-06 00:21:40 +08:00
parent 31885f65a8
commit 75638c96f8
8 changed files with 34 additions and 10 deletions

View File

@@ -206,7 +206,7 @@ namespace SqlSugar
}
protected virtual string GetTableName(EntityInfo entityInfo)
{
return entityInfo.DbTableName == null ? entityInfo.EntityName : entityInfo.DbTableName;
return this.Context.EntityProvider.GetTableName(entityInfo.DbTableName);
}
protected virtual DbColumnInfo EntityColumnToDbColumn(EntityInfo entityInfo, string tableName, EntityColumnInfo item)
{

View File

@@ -59,6 +59,16 @@ namespace SqlSugar
return mappingInfo == null ? typeName : mappingInfo.DbTableName;
}
}
public string GetTableName(string entityName)
{
var typeName = entityName;
if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return typeName;
else
{
var mappingInfo = this.Context.MappingTables.SingleOrDefault(it => it.EntityName == typeName);
return mappingInfo == null ? typeName : mappingInfo.DbTableName;
}
}
public string GetEntityName(string tableName)
{
if (this.Context.MappingTables == null || this.Context.MappingTables.Count == 0) return tableName;

View File

@@ -201,7 +201,7 @@ namespace SqlSugar
{
if (this.Context.IsSystemTablesConfig)
{
return this.Context.DbMaintenance.GetPrimaries(this.EntityInfo.DbTableName);
return this.Context.DbMaintenance.GetPrimaries(this.Context.EntityProvider.GetTableName(this.EntityInfo.EntityName));
}
else
{
@@ -212,7 +212,7 @@ namespace SqlSugar
{
if (this.Context.IsSystemTablesConfig)
{
return this.Context.DbMaintenance.GetIsIdentities(this.EntityInfo.DbTableName);
return this.Context.DbMaintenance.GetIsIdentities(this.Context.EntityProvider.GetTableName(this.EntityInfo.EntityName));
}
else
{

View File

@@ -18,11 +18,20 @@ namespace SqlSugar
break;
case ResolveExpressType.WhereMultiple:
break;
case ResolveExpressType.SelectSingle:
case ResolveExpressType.SelectMultiple:
case ResolveExpressType.Update:
parameter.BaseParameter.CommonTempData = expression.Name;
break;
case ResolveExpressType.SelectSingle:
case ResolveExpressType.SelectMultiple:
if (parameter.BaseParameter!=null&&parameter.BaseParameter.CurrentExpression.NodeType == ExpressionType.Lambda)
{
this.Context.Result.Append(expression.Name + ".*");
}
else
{
parameter.BaseParameter.CommonTempData = expression.Name;
}
break;
case ResolveExpressType.FieldSingle:
break;
case ResolveExpressType.FieldMultiple:

View File

@@ -17,5 +17,5 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1c022a5c-4e4d-4026-a8a3-f659b9740a1a")]
[assembly: AssemblyVersion("4.1.0.9")]
[assembly: AssemblyFileVersion("4.1.0.9")]
[assembly: AssemblyVersion("4.1.1.0")]
[assembly: AssemblyFileVersion("4.1.1.0")]

View File

@@ -47,7 +47,7 @@ namespace SqlSugar
else if (Skip != null && Take != null)
{
if (this.OrderByValue == "ORDER BY ") this.OrderByValue += GetSelectValue.Split(',')[0];
return string.Format(PageTempalte, GetSelectValue, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, GetOrderByString, Skip.ObjToInt() > 0 ? Skip.ObjToInt() : 0, Take);
return string.Format(PageTempalte, GetSelectValue, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, GetOrderByString, Skip.ObjToInt() > 0 ? Skip.ObjToInt(): 0, Take);
}
else
{
@@ -55,7 +55,7 @@ namespace SqlSugar
}
}
#endregion
#region Get SQL Partial

View File

@@ -284,6 +284,11 @@ namespace SqlSugar
UpdateableProvider<T> reval = base.CreateUpdateable(UpdateObjs);
return reval;
}
public virtual IUpdateable<T> Updateable<T>(List<T> UpdateObjs) where T : class, new()
{
Check.ArgumentNullException(UpdateObjs, "Updateable.UpdateObjs can't be null");
return Updateable(UpdateObjs.ToArray());
}
public virtual IUpdateable<T> Updateable<T>(T UpdateObj) where T : class, new()
{
return this.Updateable(new T[] { UpdateObj });

View File

@@ -2,7 +2,7 @@
<package >
<metadata>
<id>sqlSugarCore</id>
<version>4.1.0.9</version>
<version>4.1.1.0</version>
<authors>sunkaixuan</authors>
<owners>Landa</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>