By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,504 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,504 IT Pros & Developers. It's quick & easy.

Facing hard work ahead..

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message
news:AY********************@giganews.com...
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

Nov 20 '05 #2

P: n/a
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

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:ee*************@TK2MSFTNGP11.phx.gbl...
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

"Fredrik Melin" <me*@n.o.spam.dacsa.net.remove.as.needed> wrote in message
news:AY********************@giganews.com...
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


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.