简体   繁体   中英

How to handle unexpected disconnect

I've got a question concerning best practices with .NET remoting. The code is smelly and I need to do some refactoring.

The thing is: I've got multiple classes that derive from MarshalByRefObject and their data is used in the client software. Once the server disconnects I get RemotingException.

The bad thing about this is: My references to all the MarshalByRefObjects are all over the place (including but not limited to the GUI) and upon disconnection the exception turns up anywhere in my code.
Obviously I'd like to handle those exceptions in one place. Are there any best practices for this?

Essentially, I'd like to put together some sort of "offline" -mode for the client

设法通过使用代理设计模式来解决此问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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