在进行远程方法调用时,我得到了 OutOfMemoryException。
“RemoteEntity.SetLocalStore(数据集);”
传递的值是数据集。
注意数据集大小为 38mb
环境 c# VS2008
谢谢
代码 :
private void backgroundSync_DoWork(object sender, DoWorkEventArgs e)
{
backgroundSync.ReportProgress(10, "Fetching data for sync ...");
EngagementSet _remoteSet = HKMPClient.Instance.RemoteEntity.GetLocalStore();
//Update to release memory.
HKMPClient.Instance.RemoteEntity.SetLocalStore(null);
//dispose RemoteEntity
HKMPClient.Instance.DisconnectAndDispose();
HKMP.EngagementWorks.Windows.BLL.Engagements.Engagement.MergeEntitiesInLimitedConnecitivity(_remoteSet,EngagementID);
backgroundSync.ReportProgress(10, "Synchronizing Engagement ...");
DialogSync _dlgSync = new DialogSync(this.EngagementID, _remoteSet);
_dlgSync.ServiceRequestStarted += new DialogSync.OnServiceRequestStarted(_dlgSync_ServiceRequestStarted);
_dlgSync.ServiceRequestCompleted += new DialogSync.OnServiceRequestCompleted(_dlgSync_ServiceRequestCompleted);
if (_dlgSync.IsShown())
{
_dlgSync.StartPosition = FormStartPosition.CenterParent;
_dlgSync.WindowState = FormWindowState.Normal;
_dlgSync.ShowDialog();
}
//Disposed to release object.
_dlgSync.Dispose();
_dlgSync = null;
// connect again
HKMPClient.Instance.Connect(e.Argument.ToString());
_remoteSet.RemotingFormat = SerializationFormat.Binary;
HKMPClient.Instance.RemoteEntity.SetLocalStore(_remoteSet);
}