sapiens / SqlFu

Fast and versatile .net core data mapper/micro-orm
Other
229 stars 50 forks source link

Set CommandTimeout on PagedQuery #43

Closed yellokondi closed 10 years ago

yellokondi commented 10 years ago

I see that you have provided a solution for Query< T > method in Issue#36. However, I would like to use that in batch oriented query resultsets. How can I accomplish that?

I am trying the following with no luck:

db.WithSql(sql).Apply(cmd=>cmd.CommandTimeout = 200); PagedResult< myClass > rez = db.PagedQuery(skip, take, sql);

This still times out after default 30 seconds. I believe, I should be able to get that going if I would be able to do the following:

db.WithSql(sql).Apply(cmd=>cmd.CommandTimeout = 200).PagedQuery< myClass >(skip, take);

but this is not available in SqlFu ver. 2.3.5.0 Do you plan on providing that functionality for SqlFu? Do you have something I can use as a work around?

sapiens commented 10 years ago

It won't work since PagedQuery executes 2 queries and you can't share settings between helpers. The only workaround is to rewrite (copy/paste) the helper to accept a timeout.

yellokondi commented 10 years ago

Coolio, I will do that. It is only one time use application so I do not need to maintain SqlFu with that change being present. Thanks!!