maxtoroq / DbExtensions

Data-access framework with a strong focus on query composition, granularity and code aesthetics.
https://maxtoroq.github.io/DbExtensions/
Apache License 2.0
227 stars 41 forks source link

CommandTimeout setting #52

Closed weisso5 closed 6 years ago

weisso5 commented 7 years ago

Hello, Excellent library. Running into a Command Timeout situation when using Map:

db.Map<SomeObject>(sql).ToArray();

I know there is the db.CreateCommand(sql); but then you lose the nice and simple POCOMapping you offer.

Any plans to allow settings to be pushed into the internal call to CreateCommand (or another solution):

return (IEnumerable<TResult>) new MappingEnumerable<TResult>(this.CreateCommand(query), mapper, this.Configuration.Log);

Thanks.

maxtoroq commented 7 years ago

I think having a configuration setting would be the least intrusive change, although it would affect all commands, but you could temporarily set then reset it.

Actually, there was a Map extension method for IDbCommand in v5, but the API was simplified in v6 and most extension methods didn't make the cut.

weisso5 commented 7 years ago

Agreed, I was looking at it at the same way transaction was set:

if (transaction != null) { command.Transaction = transaction; }

thus would affect all commands created with this Database object, Look forward to see what you come up with.

maxtoroq commented 7 years ago

Note to self: Consider making CreateCommand(string, object[]) virtual.

maxtoroq commented 6 years ago

Shipped in v6.1.0