Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing return type when initiating a select query #483

Closed
dom3551-git opened this issue May 20, 2021 · 2 comments
Closed

Forcing return type when initiating a select query #483

dom3551-git opened this issue May 20, 2021 · 2 comments

Comments

@dom3551-git
Copy link

dom3551-git commented May 20, 2021

Hi, rather than using the generic overload on the Get method to return a strongly typed result, would it be possible to set the return type when initialising the query....so something like

var products = db.Query<Product>("Products")

This would allow me to embed initialising the query into a Repository class method with the database table name and typed result set automatically, something like...

class Product { public Query<Product> GetProducts() { return db.Query<Product>("Products"); } }

Once the query is executed, it then returns the typed set automatically.....

@ahmad-moussawi
Copy link
Contributor

This wont work for queries with custom selections, check #183

@dom3551-git
Copy link
Author

dom3551-git commented May 27, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants