command-timeout

How to set Nhibernate LINQ Command Timeout using Session.Query

半城伤御伤魂 提交于 2020-01-14 09:48:32
问题 Is anyone aware of a way to set the UnderlyingCriteria when using Session.Query ? I'm trying to set a more restrictive command timeout (or query timeout) for one specific query and I am trying to avoid adding that constraint on the connection or other querys in the session. I've found in the old QueryOver functionality you could use something like this // QueryOver returns a IQueryOver<T,T> an nHibernate class // with access to UnderlyingCriteria var query = Session.QueryOver<Puppy>(); query

How to set CommandTimeout

你。 提交于 2020-01-13 08:29:07
问题 I am using Microsoft.SqlServer.Management.Smo . My Code: Server server = new Server(new ServerConnection( new SqlConnection(ConnectionString)); server.ConnectionContext.ExecuteNonQuery(script); I want to set CommandTimeout for it like we do with normal SQLCommand Please tell me how to set CommandTimeout for queries running through Microsoft.SqlServer.Management.Smo.Server 回答1: Try server.ConnectionContext.StatementTimeout 回答2: You can set command timeout using the SMO object as shown below:

SMO ConnectionContext.StatementTimeout setting is ignored

醉酒当歌 提交于 2019-12-18 07:05:21
问题 I am successfully using Powershell with SMO to backup most databases. However, I have several large databases in which I receive a "timeout" error "System.Data.SqlClient.SqlException: Timeout expired". The timout consistently occurs at 10 minutes. I have tried setting ConnectionContext.StatementTimeout to 0, 6000, and to [System.Int32]::MaxValue. The setting made no difference. I have found a number of Google references which indicate setting it to 0 makes it unlimited. No matter what I try,

Set Command Timeout in EF 6

倾然丶 夕夏残阳落幕 提交于 2019-12-17 09:59:20
问题 I want to set command timeout for query execution, currently I am doing context.Database.CommandTimeout = 90; but i feel this is not working, I tried checking the process logs in database but found the time difference was always less than 90sec. Can someone help how can I set the database timeout in Entity Framework 6? 回答1: Check this : Entity Framework 6 : this.context.Database.CommandTimeout = 180; Entity Framework 5: ((IObjectContextAdapter)this.context).ObjectContext.CommandTimeout = 180;

WebMatrix Database.Query with Custom CommandTimeout

梦想与她 提交于 2019-12-14 03:57:33
问题 Consider the following TestDb with TestTable and Procedure USE TestDb GO --DROP TABLE dbo.TestTable IF NOT EXISTS (SELECT 1 FROM sys.tables WHERE name = 'TestTable') BEGIN CREATE TABLE dbo.TestTable ( RecordId int NOT NULL IDENTITY(1,1) PRIMARY KEY , StringValue varchar(50) NULL , DateValue date NULL , DateTimeValue datetime NULL , MoneyValue money NULL , DecimalValue decimal(19,4) NULL , IntValue int NULL , BitValue bit NOT NULL ) INSERT INTO dbo.TestTable SELECT 'Test', CAST(GETDATE() AS

Code takes time that varies system to system

拟墨画扇 提交于 2019-12-13 08:57:36
问题 I am facing a problem for last 15 days. I have a code which contains a do-while loop and inside that there are 4 for loops. in each loop the following function is called. Public Function retds1(ByVal SPName As String, ByVal conn As SqlConnection, Optional ByVal ParameterValues() As Object = Nothing) As DataSet dconn = New SqlConnection(ConfigurationManager.ConnectionStrings("webriskpro").ConnectionString) Try sqlcmd = New SqlCommand ds = New DataSet If dconn.State = ConnectionState.Open Then

What would cause/how can I prevent a ContextSwitchDeadlock?

北城以北 提交于 2019-12-12 18:39:26
问题 I have a rather long-running process in a Windows Service that periodically throws a "ContextSwitchDeadlock" exception: I have also rigged my service to send myself emails with details about encountered exceptions. I get: Date: 05/25/2016 09:16:32: Exception message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Exception Source: .Net SqlClient Data Provider ...and then three seconds later this: Date: 05/25/2016 09:16:35:

Why am I getting “timeout” and “Cannot find table 0” and what preventive measures are at my disposal?

六眼飞鱼酱① 提交于 2019-12-12 05:07:38
问题 In the answer to a previous question here, I was advised to also ask about this related issue. Once in awhile, the report generation code I have throws two exceptions (they don't display to the user, and they think everything is hunky dory), but I get them emailed to me. The first is, " Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. " ...and the one that always follows quickly thereafter is, " Cannot find table 0 " The first

Setting Linq to NHibernate ADO Command Timeout

一个人想着一个人 提交于 2019-12-10 18:54:54
问题 How do I increase the timeout in NHibernate Linq To Sql? Not the Connection Timeout but the ado command timeout. using (ISession session = NHibernateHelper.OpenSession(NHibernateHelper.Databases.CarrierCDR)) using (session.BeginTransaction(IsolationLevel.ReadUncommitted)) { lCdrs = (from verizon in session.Linq<Domain.Verizon>() where verizon.Research == true && verizon.ReferenceTable == null orderby verizon.CallBillingDate descending select verizon).ToList(); } 回答1: if you are configuring

Timeout exception when timeout set to infinite time

心不动则不痛 提交于 2019-12-10 18:48:40
问题 In my C# .NET 3.5 application I am using CastleProject ActiveRecord over NHibernate. This is desktop application using MS SQL Server 2008. I have set ADO command timeout to 0 to prevent timeout exception during bulk operations: <activerecord> <config> ... <add key="hibernate.command_timeout" value="0" /> </config> </activerecord> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> ... <property name="command_timeout">0</property> </session-factory> </hibernate