views:

68

answers:

1

What does an Asynchronous ORM really mean ? How does it differ in behaviour from a regular ORM ?

Where can it be used ?

+3  A: 

It means the calls to it return right away (doesn't block). You get the result at some later point in time, most likely due to a callback firing.

Something like this (pseudo-code):

function printResult(result)
    if result is "foo" print "FOO" else print "BAR"

function fooBar()
    Orm.myQuery().setCallback(printResult)
    Orm.myOtherQuery().setCallback(printResult)

In this example, both queries would be executed at the same time (and the response from the second query could come before the first).

It is useful in a program that is uses non-blocking IO. Having queries execute at the same time, perhaps on multiple databases, is great latency wise. If each query takes 1 ms, doing 10 queries still just takes 1 ms, instead of 10 ms.

truppo
Not blocking the thread isn't actually the most important issue: a connection normally can't be used asynchronously anyway (i.e. this approach will work only if you send your queries on different connections). Grouping of multiple queries together is normally more important: you anyway can do some work on the client while the query is executed; but if queries are relatively simple, grouping them together saves lots of roundtrips to database. Many ORMs (NHibernate, DataObjects.Net at least) provide support for future (delayed) queries, that are more attractive from this point.
Alex Yakunin