cjexxi wrote:
I'll take a look about unitofwork later.
Meanwhile, the reason I'm looking for ORM framework is to eliminate or at least minimize the usage of Stored Procedure, because it's getting out of hand maintaining so many SP.
With prefetch path, I can retrive related entities within one roundtrip. Based on this
may be it is also possible that I can also fetch unrelated entities within one roundtrip also.
Prefetch paths make 1 roundtrip per node. So if you fetch customers - orders - order details - products, it needs 4 roundtrips. This is inevidable, as it has to handle all graph types. It uses the same connection so roundtrip times are limited to the bare minimum.
For example:
IBatchFetch batch = new IBatchFetch();
AuthEntity auth = new AuthEntity("admin");
BalanceEntity ball = new BalanceEntity("user1");
CurrencyEntity curr = new CurrencyEntity("USD");
batch.Add(auth);
batch.Add(ball);
batch.Add(curr);
batch.Fetch(); //batch loading.....
What do you think of this?
This still requires 3 queries being executed as 3 different resultsets. To limit roundtrip time, you could do: (only adapter)
// instantiate a DataAccessAdapter instance and signal it to keep open the connection
using(DataAccessAdapter adapter = new DataAccessAdapter(true))
{
adapter.OpenConnection();
// do the fetches here, all 3
adapter.FetchEntity(auth);
adapter.FetchEntity(ball);
adapter.FetchEntity(curr);
adapter.CloseConnection();
}
This will make 3 roundtrips, but over the same connection, which should limit the time spend on the routine.