Shared static classes between AppDomains in loaded library code

Posted by Christian Stewart on Stack Overflow See other posts from Stack Overflow or by Christian Stewart
Published on 2013-07-02T01:35:57Z Indexed on 2013/07/02 5:05 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

I'm working on a program in which I want to do something similar to what the Photon Server system does:

  • Offer a common "API" class library, which contains common data classes, enumerations, and interfaces for working with the host program.
  • Have client programs (class libraries) reference this DLL and implement interfaces listed within it.
  • Have the "host" application load built DLL client libraries into separate AppDomains and reference the interfaces that lie within to have polymorphic client code from within a dll file.

I have something like this worked out: a class library that contains common code, but I've run into the following question

How should I handle static classes? Should I add a method that is called by the host program to synchronize data? How do I keep a static class the same between AppDomains? Should I discard these classes in favor of better interfaces between the code levels?

And in general, how do I share data between these loaded AppDomains?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET