src/Inflatable/QueryProvider/Providers/SQLServer/QueryGenerators/LoadPropertiesQuery.cs
/// <summary>
/// Generates the parent from clause.
/// </summary>
/// <param name="manyToOne">The many to one.</param>
/// <param name="parentMapping">The parent mapping.</param>
/// <param name="suffix">The suffix.</param>
/// <returns></returns>
Generates the parent from clause.
Generates the parent from clause .
private string GenerateParentFromClause(IManyToOneProperty manyToOne, IMapping parentMapping, string suffix)
        {
            var Result = ObjectPool.Get();
            var TempIDProperties = ObjectPool.Get();
            var Separator = string.Empty;
            foreach (var ForeignMapping in manyToOne.ForeignMapping)
            {
                foreach (var IDProperty in ForeignMapping.IDProperties)
                {
                    TempIDProperties.AppendFormat("{0}{1}={2}",
                        Separator,
                        GetTableName(parentMapping, suffix) + ".[" + manyToOne.ColumnName + ForeignMapping.TableName + IDProperty.ColumnName + "]",
                        GetColumnName(IDProperty));
                    Separator = " AND ";
                }
            }
            Result.AppendLine();
            var AsStatement = string.IsNullOrEmpty(suffix) ? string.Empty : " as [" + parentMapping.TableName + suffix + "]";
            Result.AppendFormat("INNER JOIN {0} ON {1}", GetTableName(parentMapping) + AsStatement, TempIDProperties);
            var ReturnValue = Result.ToString();
            ObjectPool.Return(Result);
            ObjectPool.Return(TempIDProperties);
            return ReturnValue;
        }
private string GenerateParentFromClause ( IManyToOneProperty manyToOne , IMapping parentMapping , string suffix ) { var Result = ObjectPool . Get ( ) ; var TempIDProperties = ObjectPool . Get ( ) ; var Separator = string . Empty ; foreach ( var ForeignMapping in manyToOne . ForeignMapping ) { foreach ( var IDProperty in ForeignMapping . IDProperties ) { TempIDProperties . AppendFormat ( " " , Separator , GetTableName ( parentMapping , suffix ) + " " + manyToOne . ColumnName + ForeignMapping . TableName + IDProperty . ColumnName + " " , GetColumnName ( IDProperty ) ) ; Separator = " " ; } } Result . AppendLine ( ) ; var AsStatement = string . IsNullOrEmpty ( suffix ) ? string . Empty : " " + parentMapping . TableName + suffix + " " ; Result . AppendFormat ( " " , GetTableName ( parentMapping ) + AsStatement , TempIDProperties ) ; var ReturnValue = Result . ToString ( ) ; ObjectPool . Return ( Result ) ; ObjectPool . Return ( TempIDProperties ) ; return ReturnValue ; }
Generates the parent from clause.
Generates the parent from clause .
None
manyToOne
IManyToOneProperty
The many to one.
The many to one .
parentMapping
IMapping
The parent mapping.
The parent mapping .
suffix
string
None