Skip to content

No longer able to provide SQL parameters to ExecuteAsync() since 6.0.0 #721

@PeterN

Description

@PeterN

With NPoco 5.7.1, I used to be able do the following. (This is a dumbed-down example, the real query is more complex.)

await db.ExecuteAsync(@";
      select @created, @modified, @id",
      new
      {
          created = DateTime.UtcNow,
          modified = DateTime.UtcNow,
          id = 1
      });

Since NPoco 6.0.0, a cancellationtoken parameter is added, and the code no longer compiles with the following error.

error CS1503: Argument 2: cannot convert from '<anonymous type: System.DateTime created, System.DateTime modified, int id>' to 'System.Threading.CancellationToken'

The function's signature is changed from Task<int> ExecuteAsync(string sql, params object[] args) to Task<int> ExecuteAsync(string sql, object[] args, CancellationToken cancellationToken = default(CancellationToken)), so without the params part it no longer works.

I don't see anything about this change in the release notes, so I'm not sure what I'm meant to be doing differently now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions