A .NET Framework remoting server hosts a class library that contains the following class.
public class SimpleMathClass : MarshalByRefObject
{
public int LogData(DataRow dr)
{
//Lengthy database calls …
}
}
Users of a Windows-based client application report that the application often becomes nonresponsive.
You discover that the application makes calls to the LogData method that take several seconds to return.
The return value is required to generate reports in the client application.
You need to ensure that calls to the LogData method can be processed without making the client application nonresponsive.
What should you do?
A.
Apply the OneWay attribute to the LogData method.
B.
In the client code, declare a delegate that has the same signature as the LogData method.
On the client application’s main thread, call the delegate’s BeginInvoke method and pass in the necessary data.
On a second thread, call the EndInvoke method on the delegate to get the results.
C.
Call the LogData method by using the ThreadPool.QueueUserWorkItem method.
D.
In the client code, declare a delegate that has the same signature as the LogData method.
On the client application’s main thread, call the delegate’s Invoke method and pass in the necessary data.
On a second thread, call the GetObjectData method on the delegate to get the results.