/// <summary> /// Appends a single part, including (useless) optimizations /// </summary> /// <param name="parts"></param> /// <param name="index"></param> /// <param name="part"></param> public static void InsertPart(IList<SqlPart> parts, int index, SqlPart part) { // optimization if top part is a literal, and the one we're adding is a literal too // in this case, we combine both // (this is useless, just pretty) if (part is SqlLiteralPart && index > 0 && parts[index - 1] is SqlLiteralPart) { parts[index - 1] = new SqlLiteralPart(parts[index - 1].Sql + part.Sql); } else parts.Insert(index, part); }
/// <summary> /// Appends a single part, including (useless) optimizations /// </summary> /// <param name="parts"></param> /// <param name="index"></param> /// <param name="part"></param> public static void InsertPart(IList <SqlPart> parts, int index, SqlPart part) { // optimization if top part is a literal, and the one we're adding is a literal too // in this case, we combine both // (this is useless, just pretty) if (part is SqlLiteralPart && index > 0 && parts[index - 1] is SqlLiteralPart) { parts[index - 1] = new SqlLiteralPart(parts[index - 1].Sql + part.Sql); } else { parts.Insert(index, part); } }
/// <summary> /// Adds the part to the given parts list. /// </summary> /// <param name="parts">The parts.</param> /// <param name="part">The part.</param> public static void AddPart(IList<SqlPart> parts, SqlPart part) { InsertPart(parts, parts.Count, part); }
/// <summary> /// Adds the part to the given parts list. /// </summary> /// <param name="parts">The parts.</param> /// <param name="part">The part.</param> public static void AddPart(IList <SqlPart> parts, SqlPart part) { InsertPart(parts, parts.Count, part); }