asherber/PetaPoco.SqlKata

ToSql()

Closed this issue · 2 comments

I find on file:SqlKataExtensions.cs

public static Sql ToSql(this Query query, CompilerType compilerType)
    {
      Query query1 = query;
      if (query1 == null)
        throw new ArgumentNullException(nameof (query));
      query = query1;
      SqlResult sqlResult = SqlKataExtensions._compilers[compilerType].Value.Compile(query);
      return new Sql(Helper.ReplaceAll(sqlResult.RawSql, "?", (Func<int, string>) (x => "@" + (object) x)), sqlResult.Bindings.ToArray());
    }

the para query1 only check is null, why use query for check null?

I think you must be looking at that in a decompiler which is doing something odd. The actual code doesn't use a separate variable there.

got it, it's sure I look it in a decompiler.