Jader Dias
Jader Dias

Reputation: 90535

How to bind the Command Timeout to an dbml (Linq-To-Sql data class)?

I know that we cannot set the Command Timeout in the Connection String. So I put it in the MyDataContext constructor. But there are many constructors, this file is usually overwritten by the visual designer and it doesn't seems the right way to do that. How would you do that?

Upvotes: 4

Views: 2785

Answers (1)

Jader Dias
Jader Dias

Reputation: 90535

I was putting the code in the constructor, but the right way to do that is to create a separate file and paste the code below:

partial class DataClassesDataContext
{
    partial void OnCreated()
    {
        this.CommandTimeout = Settings.Default.CommandTimeout;
    }
}

Upvotes: 6

Related Questions