Data Retrieval in a SignalR Hub/Service?
I am used to repo -> service -> controller MVC models, and I do not have much experience with in-memory retrieval beyond using LinQ.
Say I have a class which could have multiple queryable fields:
In a normal appcontextdb access scenario, I would just pull out the values using EFCore LinQ using something like
In my SignalR Hub, I am using an in-memory method and not SQL to store my data since I don't expect users to have long-lasting data (unlikely they will maintain a connection for >5minutes per session). Therefore I inject a
Say I have a class which could have multiple queryable fields:
In a normal appcontextdb access scenario, I would just pull out the values using EFCore LinQ using something like
In my SignalR Hub, I am using an in-memory method and not SQL to store my data since I don't expect users to have long-lasting data (unlikely they will maintain a connection for >5minutes per session). Therefore I inject a
ConnectedClientsService and don't have a DB table.- Is using
FirstOrDefaultAsyncwith regular IQueryable is more standard practice in this case (for example, searching for strings matching region, etc)? - Is it standard practice to use 2 concurrent dictionaries with a lock to enable O(1) access?