Added a configurable CommandTimeout setting
Hi,
I have tried creating a pull request and have been unsuccessful; very good chance that I am not doing it correctly :)
We have experienced some long running stored procedures. When this happens, we typically have to apply a Database.CommandTimeout to the DbContext; this is not definable in the connection string.
To facilitate this I have added a setting into the Database.tt file to allow setting the command timeout.
This is then utilized by the EF.Reverse.POCO.Core.ttinclude and EF.Reverse.POCO.ttinclude files
Perhaps you can make use of the change in a future revision?
Changes were:
Line 17 of Database.tt
DbCommandTimeout = 60; // sets the DbContext.Database.CommandTimeout property. If 0 then it will be ignored.
Line 37 of EF.Reverse.POCO.Core.ttinclude
int DbCommandTimeout = 0;
And this, added into each of the of the DbContext constructors; around lines 240, 249, 258,267,276 of EF.Reverse.POCO.ttinclude (I didn't add it to the Fake DbContext)
<#if(DbCommandTimeout > 0) {#> this.Database.CommandTimeout = <#=DbCommandTimeout#>;
<#}#>
The correct way to do this is to set MakeClassesPartial = true; then create a partial db context, and override the InitializePartial(); function to set anything you want, including the command timeout.
Let me know if you want this re-opened, or if there are other issues.
Ah, ok, perfect; didn't think of that :)
Thanks!