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

Add docs on querying data #35

Open
Netclick19 opened this issue Jun 1, 2020 · 3 comments
Open

Add docs on querying data #35

Netclick19 opened this issue Jun 1, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@Netclick19
Copy link

Hi,
it could be an improvement extend searches for all fields in api services.

Samples
search page by name
search media by filename,
search site by cultures, ....

@tidyui
Copy link
Member

tidyui commented Jun 1, 2020

Hi! There’s a very simple approach to this and reason we don’t include it in our services.

When you build your application you KNOW what your current data layer is, we don’t. In most cases it will probably be EF, but in other cases you could your data stored in JSON files or whatever.

So the simple approach is:

  1. Inject the IDb into your method
  2. Make your query against the DbContext
  3. If you’re getting models that need transformation, like pages & posts, just select the id field and the load the models using the services.

In most production scenarios some level of caching will be used which will keep down database access.

I will try to write up some docs for this with examples.

Best regards!

@tidyui
Copy link
Member

tidyui commented Jun 1, 2020

In fact, I will move this issue to the docs repo 😁

@tidyui tidyui transferred this issue from PiranhaCMS/piranha.core Jun 1, 2020
@tidyui tidyui added the enhancement New feature or request label Jul 1, 2020
@tidyui tidyui changed the title Add more search filters in Api service Add docs on querying data Aug 22, 2020
@axunonb
Copy link
Contributor

axunonb commented Jan 17, 2021

Do the tutorials in c99e88d close this issue?

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

No branches or pull requests

3 participants