RacerDelux
Explore posts from serversBest Way To Load and Cache Scoped Data?
I am using MediatR, so scoped services essentially live the lifetime of the MediatR request.
Given that, I want to load configuration from a database if not loaded (using Entity Framework), then cache the returned data, as it is used multiple times for the request.
What is the best way to go about this? This is my current code, but this is blocking and I would think could cause performance issues.
This particular example would remove 4 round trip database calls.
11 replies
Dynamic Order By Entity Framework
I have the following query:
I was asked to make it so that searchText can have multiple searches, IE:
If I type in "Hello World", I should have the results ordered so that anything that starts with "Hello" or "World" appears first. But this needs to be dynamic in length.
So the search text "Hello World Bob" would check for three items.
In addition, I need to support partial matches. So "Hel Wor Bo" would at minimum return the same results as "Hello World Bob".
How would I go about doing this? If I didn't need to worry about partial matches, I could just do
p => searchText.Contains(p.Name)
.
But I need to support partial queries.16 replies