sapiens / SqlFu

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

OnCommand not work #57

Closed davidhxy678 closed 9 years ago

davidhxy678 commented 9 years ago

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?

sapiens commented 9 years ago

OnCommand is meant for logging purposes. What you want is

db.WithSql(sql,args).Apply(cmd=>cmd.CommandTimeout = 120 ).Query<MyType>()
davidhxy678 commented 9 years ago

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

sapiens commented 9 years ago

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