-
Notifications
You must be signed in to change notification settings - Fork 930
Open
Description
Hi,
I am trying to set the command_timeout but it looks like it only affects Insert actions. Can you confirm if I am using the fluent API correct or if it is not related to fluent API.
A) I set the command_timeout to 10 seconds (just for testing the real value should be higher)
B) I set a trigger on the table to do a wait
- I do a Insert and that times out after 10 seconds
- I do a Update and that times out after 30 seconds (default NHibernate value I assume)
- I tested the same with delete and the timeout is also 30 seconds
Shouldn't the command_timeout affect all commands?
Thanks
Mikkel
Below is the example I used:
I setup a factory like so:
A)
var factory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(conString).ShowSql())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>())
.ExposeConfiguration(cfg => cfg.SetProperty(NHibernate.Cfg.Environment.CommandTimeout, "10"))
.BuildSessionFactory();
B)
On my test table I added a trigger (INSERT, UPDATE and DELETE) that just have "WAITFOR DELAY '00:00:45'"
- When I do a Insert:
using (var session = factory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
var test = new Testtable() { Time = DateTime.Now };
session.Save(test);
transaction.Commit();
}
}
This times out after 10 seconds.
- When I do an Update:
using (var session = factory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
var test = session.Get<Testtable>(1); //Id = 1 is in the DB
test.Time = DateTime.Now;
session.Update(test);
transaction.Commit();
}
}
This timeout after 30 seconds
Metadata
Metadata
Assignees
Labels
No labels