Update Simple join

This commit is contained in:
sunkaixuan
2017-07-06 01:27:05 +08:00
parent 75638c96f8
commit 89875cf3f1
3 changed files with 23 additions and 4 deletions

View File

@@ -23,9 +23,21 @@ namespace OrmTest.UnitTest
Q1();
Q2();
Q3();
Q4();
}
base.End("Method Test");
}
private void Q4()
{
using (var db = GetInstance())
{
db.MappingTables.Add("School", "SchoolTable");
var join4 = db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id).Select(st=>st).ToSql();
string sql = @"SELECT st.* FROM [STudent] st ,[SchoolTable] sc WHERE ( [st].[SchoolId] = [sc].[Id] ) ";
base.Check(sql, null, join4.Key, null, "join 4 Error");
}
}
private void Q3()
{

View File

@@ -385,13 +385,14 @@ namespace SqlSugar
}
if (this.EasyJoinInfos.IsValuable())
{
if (this.TableWithString.IsValuable())
{
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} {2} ", it.Value, it.Key, TableWithString)));
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} {2} ",GetTableName(it.Value), it.Key, TableWithString)));
}
else
{
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} ", it.Value, it.Key)));
result += "," + string.Join(",", this.EasyJoinInfos.Select(it => string.Format("{0} {1} ", GetTableName(it.Value), it.Key)));
}
}
return result;
@@ -425,5 +426,11 @@ namespace SqlSugar
}
}
#endregion
private string GetTableName(string entityName)
{
var result = this.Context.EntityProvider.GetTableName(entityName);
return this.Builder.GetTranslationTableName(result);
}
}
}

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.1.1.0")]
[assembly: AssemblyFileVersion("4.1.1.0")]
[assembly: AssemblyVersion("4.1.1.1")]
[assembly: AssemblyFileVersion("4.1.1.1")]