[CSHARP-5] Async IO Created: 17/Feb/10  Updated: 21/Mar/14  Resolved: 11/Nov/10

Status: Closed
Project: C# Driver
Component/s: SAMUS
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Sam Corder Assignee: Sam Corder
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File IMongoCollection_1.Async.cs     Text File MongoCollection_1.Async.cs    

 Description   

Add capability to asynchronously read and write to the database.



 Comments   
Comment by Michael Kennedy [ 21/Mar/14 ]

Makes sense, I like it! Any idea when it'll be shipping?

Comment by Craig Wilson [ 20/Mar/14 ]

This is closed because it applied to a different driver. CSHARP-138 is the ticket you care about. However, the syntax probably wouldn't look like that, but be more in the terminating functions.

User u = await coll.AsQueryable().SingleAsync(u => u.Id == 1);
                                 .ToListAsync();
                                 // etc...

Comment by Michael Kennedy [ 20/Mar/14 ]

Is this in the current driver or on the roadmap?

something like:

User u = await coll.AsQueryableAsync().Single(u => u.Id == 1);

?

Comment by Robert Stam [ 04/Aug/11 ]

All issues before CSHARP-71 apply to a different driver (this JIRA project used to be used by the samus driver) and should be ignored.

But see also CSHARP-138 which is similar and applies to the official driver. We do intend to support an async API eventually, but it is not at the top of the list (for example, LINQ is higher).

Comment by manish patel [ 04/Aug/11 ]

Why Won't Fix/Closed? is it never going to be supported? this is serious should be top of the list when c# can support this.

Comment by Flavien [ 28/Jun/11 ]

Even without moving to .NET 4.0, this can still be implemented using the Begin.../End... pattern. To be honest, this feature should be at the top of the priority list. This is a pretty serious problem that you have to block a thread while waiting for completion of the IO. This basically prevents any serious (production) use of this driver.

Comment by Flavien [ 28/Jun/11 ]

I looked at your implementation, but unfortunately this isn't asynchronous IO. What you are doing here is borrowing a thread from the thread pool (through Task.Factory.StartNew), and running a synchronous IO on that thread, blocking the thread until the IO completes.
True asynchronous IO should not block any thread, this is why they need to be implemented bottom up (you cannot do true asynchronous IO by wrapping synchronous IO).
The problem with that is that won't scale, since you will be limited by the number of threads in your process.

Comment by nisbus [ 20/Jun/10 ]

Thanks,

I've forked the project at: http://github.com/nisbus/mongodb-csharp

I'm a complete noob at git so this fork might be a bit strange

Comment by Craig Wilson [ 19/Jun/10 ]

Nice implementation. If you'd like, you can fork the project at github and contribute that way. It makes it easy for us.

Currently we aren't targeting .NET 4.0. Perhaps we can start a 4.0 branch that has some cool stuff in it like this.

Comment by nisbus [ 19/Jun/10 ]

I created async versions of the MongoCollection interface and class using .NET 4's Tasks.
Feel free to use them if they seem useful for this.

Generated at Wed Feb 07 21:35:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.