等待操作超时,EF代码优先

时间:2014-06-19 05:55:16

标签: c# entity-framework ado.net

我在sql 2012上使用EF Code First,我想在种子方法上运行以下代码但是应用程序抛出等待操作超时异常

SqlCommand fileTableCommand2 = new SqlCommand(
                string.Format(@"
                Declare @Temp   nVarchar(500)
                Select  @Temp   = FileTableRootPath() + '{0}-Directory'
                If  (@Temp  Is Null)
                Begin
                    Alter Database {0}
                        Set FileStream  (NON_TRANSACTED_ACCESS = Full, Directory_Name = '{0}-Directory')
                End",
                            builder.InitialCatalog),
                            new SqlConnection(builder.ConnectionString));

            fileTableCommand2.Connection.Open();
            fileTableCommand2.ExecuteNonQuery();
            fileTableCommand2.Connection.Close();
当我尝试在sql server中执行时,

命令工作成功,但是使用上面的代码抛出异常。

0 个答案:

没有答案