question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose QueryDefinition parameters

See original GitHub issue

Is your feature request related to a problem? Please describe. With the current API the parameters on QueryDefinition are write-only (can only be added with WithParameter). There’s no way to access the parameters already added to the query definition.

On the other hand, the QueryText is read-only, so I can’t change it.

This means there’s no way I can’t change query definition by modifying an existing one, and I also can’t make a new one by copying the parameters from an existing one.

Describe the solution you’d like At least, the parameters should be publicly exposed. Probably with a property like this:

public IReadOnlyDictionary<string, object> Parameters { get; }

To make things simpler, there should also be a WithParameters(IReadOnlyDictionary<string, object> parameters) method.

This would make it easy to copy an existing QueryDefinition:

var newDefinition = new QueryDefinition(definition.QueryText).WithParameters(definition.Parameters);

(Admittedly the code above wouldn’t be very useful, since it would make an exact copy of the query definition. In a real scenario the query text and / or parameters would be modified)

Describe alternatives you’ve considered Nothing I can think of.

Additional context N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ImrePyhvelcommented, Jan 8, 2021

@thomaslevesque Any chance to get the conflicts resolved and get your solution merged? Found myself writing some ugly reflection code again.

1reaction
thomaslevesquecommented, Sep 12, 2019

If this change is accepted, I can submit a PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

QueryDefinition.WithParameter(String, Object) Method
Add parameters to the SQL query. ... QueryDefinition WithParameter (string name, object value); member this.WithParameter : string * obj -> Microsoft.Azure.
Read more >
c# - CosmosDb Parameterized Query using GUID
Parameters are only meant for property values and not property keys. Thus you won't be able to get this query to work using...
Read more >
QueryDefinition Class - Dundas BI
QueryDefinition Class ; Public property, MaxRecords. Gets the maximum number or records to return. ; Public property, Parameters. Gets the parameter values.
Read more >
Power BI Desktop Query Parameters, Part 1, Introduction
This article shows you how to create dynamic data sources using Power BI query parameters. You also learn how to use query parameters...
Read more >
SpEL support in Spring Data JPA @Query definitions
Parameters are exposed for indexed access ( [0] in the first method) or via the name declared using @Param . The actual SpEL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found