Closed sunsided closed 8 years ago
Might be related to #37.
@GrabYourPitchforks do you remember why we didn't make the methods async here?
Though this might be nice, the data protection stack is non-async all the way around, so it would be infeasible to make just this one API be async. A proper fix would involve changing many, many APIs, and there isn't time for that to happen.
This should be revisited. The only data store that isn't async is an in memory implementation...
FWIW I'm not opposed to making the repository APIs async. However, we need to be mindful of the fact that the caller is still always going to be sync. This implies that the conversation should focus solely on "what can we do to make it easier to write a custom repository?" rather than "how do we prevent a thread from being blocked?"
I'm thinking the underlying implementation should take care of it and it should be really easy to implement. I've looked at many implementations while implementing a Foundatio IFileStorage version... They all do crazy things and are not uniform on how they:
It's really not intuitive.
Apart from the documentation being a bit thin on
IXmlRepository
, the methods really should be async.Considering it's a repository that very likely has something to do with physical storage - which usually blocks - there should be a "native" way to use
await
within the implementation. I'm currently working on a MongoDB storage and have to resort to use blocking calls just to be able to use it as a repo. I'm pretty sure other implementations would benefit from that as well.