All,

In my application I have a repository layer which wraps access to
database queries. As NH-Linq has come on the scene we've started using
his a lot more for new apps.

However, as Linq queries are deferred until first use, I'm not sure
how to deal with common DB errors that can be retried - i.e. DB
deadlock, timeout, connection lost etc.

With NH Queries it's quite easy. I have a "QueryProcessor" that has
methods such as UniqueResult, List etc. and accepts an NH IQuery or
IMultiQuery. The logic then wraps the actual query call with retry
logic.

This way I have a common QueryProcessor for all my Repository queries.

I'm a little stuck as to how to implement this pattern for Linq
though... I can wrap the logic around every Linq query but then I have
tons of replicated code. Can I use IQueryable in the same way as
IQuery ?

Do I have to inject an IQueryable<T> into my method and then do a
ToList() to force the query to run within my retry logic?

Is there another way.. as I may end up using things like
SingleOrDefault(), First() etc instead and I'd rather not replicate
all these Linq functions as QueryProcessor method calls.

Any advice appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to