sapiens/SqlFu

OnCommand not work

Closed this issue · 3 comments

When I want to set the CommandTimeout like this way,SqlFuDao.OnCommand = cmd => cmd.CommandTimeout = 120,OnCommand not work.
I read the source code,and find that in the sqlFu.sqlFuDao.cs GetRawValue() ,
OnCommand(cmd) need to put front of the rez = cmd.ExecuteScalar(),Is it that right?

OnCommand is meant for logging purposes. What you want is

db.WithSql(sql,args).Apply(cmd=>cmd.CommandTimeout = 120 ).Query<MyType>()

thanks.Howerver,if I want to use CrudHelpers.Insert,how to set the CommandTimeout?

Currently, there aren't any helpers that accept configuration of DbCommand. I'll add that in the future