Results 1 to 4 of 4

Thread: Share same class instance between applications

  1. #1

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Share same class instance between applications

    With VB6 you could make an activeX exe and set its threadpool to 1 and with a bit of luck share the same instance of a class even in different applications, what is the .NET equviliant? I know I can use shared properties and what not to share parts of a class across mulitple instances of the class, but that only works if they are in the same application. I am figuring that what made the old activex exe trick work is the fact that it was out-of-process. So is there a way to make out of process components in .NET? Or can I use a windows service to share the class?

  2. #2
    Member
    Join Date
    Jul 2002
    Posts
    49
    Now I'm not sure exactly what this activex trick accomplishes because I've never used it, but sharing an instance of a class between applications is what .net remoting is all about. Its kind of involved but what you do is create a class and compile it into a dll then import it into a server application and a client application. If you set the class in the server to be a singleton SAO (wow, I never realized how lame that sounds) then the same class is exposed to all clients that connect. In the server you can have SAO and CAO objects, each of which can be singleton or single cell. SAO is server activated objects, this means that the server creates the object and maintains it for its lifetime (which is by default 5mins), CAO are client activated objects, these are created for each user that connects. Singleton objects are shared among all users and single cell objects are unique to each user. And it really keeps going on without explaining a hell of a lot. To summarise there are a lot of features in .net remoting and you need to read a guide if you want to actually use it. I recommend you go to http://www.microsoft.com/seminar/ and under "developer" you will find a seminar called "Develop Distributed Applications using Microsoft® .NET Remoting" this is a really good intro to .net remoting and you dont have to read anything (which is a big plus to me), it also has some demos that clearly show the differences between the different objects.

  3. #3
    Lively Member
    Join Date
    Jul 2002
    Location
    Planet Earth
    Posts
    99
    From what l understand, and point out if l'm wrong, you can used the Empty App option to build the class dll, or a web services. We're trying out the Empty App thingy at the moment.

  4. #4
    Member
    Join Date
    Jul 2002
    Posts
    49
    Yep, thats how I did it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width