public SelectSqlSection <T> Include(TableSchema foreignTable)
        {
            if (!foreignTable.IsForeignTable)
            {
                throw new Exception("这不是一个关联表");
            }

            var cols = new List <string>();

            cols.AddRange(columnNames);
            cols.AddRange(foreignTable.GetComplexColumns());
            this.columnNames = cols.ToArray();

            includeTables.Add(foreignTable.GetPropertyName(), foreignTable);

            return(this.Join(foreignTable, foreignTable.JoinWhere));
        }
Esempio n. 2
0
 /// <summary>
 /// Gets the name of the property.
 /// </summary>
 /// <returns>System.String.</returns>
 /// <remarks>
 ///     <para>创建:jason</para>
 ///     <para>日期:2016-11-10</para>
 /// </remarks>
 internal string GetPropertyName()
 {
     if (IsForeignTable)
     {
         var pn = parentTable.GetPropertyName();
         if (string.IsNullOrEmpty(pn))
         {
             return(propertyName);
         }
         else
         {
             return(pn + "." + this.propertyName);
         }
     }
     else
     {
         return(string.Empty);
     }
 }