4

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?

1 Answer 1

6

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;
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.