简体   繁体   English

无法为ADOMDConnection类设置超时属性

[英]Unable to set timeout property for ADOMDConnection class

I am using AdomdConnection connection class to connect to the Cube. 我正在使用AdomdConnection连接类来连接到多维数据集。 I am using following code. 我正在使用以下代码。

 using (var conn = new AdomdConnection(ConnString))
        {
            conn.Open();
            var cube = conn.Cubes[name];
            //Do something
            conn.Close();
        }

AdomdConnection.ConnectionTimeout Property does not have setter property. AdomdConnection.ConnectionTimeout属性没有setter属性。

The default value for connectionTimeOut property is 0, which sets the time to infinite. connectionTimeOut属性的默认值为0,它将时间设置为无限。

I have two questions: 我有两个问题:

  1. Is there any way to set the timeout property for AdomdConnection? 有什么方法可以为AdomdConnection设置超时属性吗?
  2. When the cube is busy and your try to run the program, after creating the connection when you open the connection (conn.open()), system does not come out of this statement & never executes the next line of code. 当多维数据集繁忙并且您尝试运行程序时,在打开连接(conn.open())后创建连接后,系统不会退出此语句,并且永远不会执行下一行代码。 In such cases the application becomes irresponsible and there is no exception thrown. 在这种情况下,应用程序将变得不负责任,并且不会引发任何异常。 How can I inform user about such scenarios & make a log entry. 如何通知用户此类情况并进行日志输入。

I looked into this similar tread but did not found it useful. 我研究了类似的踏板,但没有发现它有用。

Thank you 谢谢

The documentation states this for AdomdConnection.ConnectionTimeout 该文档针对AdomdConnection.ConnectionTimeout声明了这一点

Gets the time to wait for a connection to be established before the AdomdConnection stops trying to connect and generates an error. 获取在AdomdConnection停止尝试连接并生成错误之前等待建立连接的时间。

So that means the timeout just talking to the server. 因此,这意味着超时仅与服务器通信。

If you want a timeout when your running an actual command use the AdomdCommand.CommandTimeout property. 如果要在运行实际命令时超时,请使用AdomdCommand.CommandTimeout属性。

Gets or sets the time to wait for a command to run before the AdomdCommand stops trying to run the command and generates an error. 获取或设置在AdomdCommand停止尝试运行命令并生成错误之前等待命令运行的时间。

Both can be set with the connection string. 两者都可以使用连接字符串设置。

http://msdn.microsoft.com/en-us/library/microsoft.analysisservices.adomdclient.adomdconnection.connectionstring.aspx http://msdn.microsoft.com/en-us/library/microsoft.analysisservices.adomdclient.adomdconnection.connectionstring.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM