Facing hard work ahead..

  • Thread starter Thread starter Fredrik Melin
  • Start date Start date
F

Fredrik Melin

Hi,

I have used Shared functions for Connection, User, and Setup variables in my
application.
That works well for the client app, but when I was now accessing my
functions via ASP.NET of course I ran into trouble (shared is shared over
the whole application, not only a session)

So, To re-write my app to handle a local reference of the objects above, its
a "little" work (100 forms, several hundred classes)

Well If I need to, Its 6 hours hard work and its done, but what is the best
way to do it?

The diffrent approaches I see is:

First, Merge the three object into one class, call it SystemData or
whatever.

Then I can either:

Create a local variable, and on each class and form use New() to pass my
information.

Or

Create a new Base Class and Base Form that all other inherits from, in that
base, create a local protected variable and use New() to set it.

Does anybody have a better idea?
If not, which of the above is the best way to do it?

Regards
Fredrik Melin
 
Fredrik,
I would consider making Connection, User, and Setup shared properties
instead of variables.

Then make the bodies of the properties reference the Session object instead
of an actual shared variable.

Something like:

Public Shared Property Connection As Object
Get
Return Session("connection")
End Get
Set(ByVal value As Object)
Session("connection") = value
End Set
End Property

Of course you would use the actual type for the Connection property instead
of Object.

This allows your code to continue using Whatever.Connection without needing
to be modified.

Hope this helps
Jay
 
Hi,

Hmm, I think I described it a little poorly
(or I dont understand your solution)

The classes that I am talking about, isnt web-based by default, they are
build for a Windows form applicaton (that works well with shared variables)
For the WEB part, I compile those classes into a "Support dll (assembly)"
that is a separate solution with physical files linked from the windows form
solution.

So the web programmer, do only reference my support dll and he has all
functionallity that exists in the Windows Form application.

So only way the Support dll can interact with sessions is if the user sends
data into it before calling a function.

The problem is then If I Store the data in a shared variable inside the
support dll, it will be shared between all users using the ASP application.

Regards
Fredrik
 
Back
Top