Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Set database timeout in Entity Framework

public class MyDatabase : DbContext
{
    public MyDatabase ()
        : base(ContextHelper.CreateConnection("Connection string"), true)
    {
        ((IObjectContextAdapter)this).ObjectContext.CommandTimeout = 180;
    }
}

<connectionStrings>

<add name="AdventureWorksEntities"
connectionString="metadata=.AdventureWorks.csdl|.AdventureWorks.ssdl|.AdventureWorks.msl;
provider=System.Data.SqlClient;provider connection string='Data Source=localhost;
Initial Catalog=AdventureWorks;Integrated Security=True;Connection Timeout=60;
multipleactiveresultsets=true'" providerName="System.Data.EntityClient" />

</connectionStrings>
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# instantiation 
Csharp :: how to change samesite=lax to samesite=none in asp.net 
Csharp :: linq select distinct 
Csharp :: how to pass object as test case in nunit c# 
Csharp :: reflection assemblies gettypes 
Csharp :: populate toolstripitems to combobox 
Csharp :: c# text editor 
Csharp :: properties vs field c# 
Csharp :: C# bitwise complement 
Csharp :: c# linq foreach example 
Csharp :: c# SQLite execute Command 
Csharp :: c# linq where value is max and one item 
Csharp :: if equal statement c# 
Csharp :: Program to find GCD or HCF of two numbers c# 
Csharp :: save a string as file to drive appscript 
Csharp :: unity Polymorphism 
Csharp :: Delegates in UntiyC# 
Csharp :: assign a list to another in c# without a loop 
Csharp :: unity editor window mesh field 
Csharp :: c# webbrowser control append 
Csharp :: c# initialize array of objects 
Csharp :: how to get connection string from xml file in c# 
Csharp :: Difference between Math.Floor() and Math.Truncate() 
Csharp :: translate nicely between two vector3 
Csharp :: is it possible to be palindrome 
Csharp :: convert memorystream to byte array c# 
Csharp :: euler angles to quaternion unity 
Csharp :: Selecting item from listview in C# 
Csharp :: stackpanel opacity mask from resources wpf 
Csharp :: enemy turret one direction ahooting script unity 2d 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =