-
Notifications
You must be signed in to change notification settings - Fork 15
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
Async Object Mapping #10
Comments
It is possible I think I saw your question on the main LiteDb project. Do you have an example of the code you want to implement? Like an example of how you do it now in the synchronous way and how you would like to do it in Async? |
@mlockett42 heres a good example,
The proposed solution would involve something like the following.
Obviously the Uri class doesn't require any asynchronous context, but I can name a few objects that require specifically asynchronous construction. Async constructors dont exist, but many asyncronous libraries do not allow you to construct objects without an asynchronous context (or the threat of blocking lots of things that shouldn't be blocked). Supporting asyncronous callbacks going forwards would improve compatibility (at least until litedb officially supports async). |
I have had a look at this. This is how I think it works from a couple of hours of reading the code. The only use case I can think up for this is the user wants look up the mapped value in a large database that requires IO. Then one special case needs to be considered we need to deal with what happens if the async mapper function then calls back into the same LiteDatabaseAsync instance. If the async calls to the map functions are called in the background thread they will deadlock the library (because it won't be able to top anything off the internal queue, but it won't be able to read the next item off the queue until the ansync mapper returns. Seems complicated- well the existing mapper looks complicated. @mookid8000 has be doing some work on this library. I would like to get his input on this. |
@mlockett42 sorry, don't have an opinion on this 😐 |
Going to work on another feature in LiteDb.Async before coming back to this one |
Is there any way this library can be extended to support asynchronous calls in a custom object mapper? if there is, that would be greatly appreciated if it could be added! I would be happy to contribute if needed.
The text was updated successfully, but these errors were encountered: