473,508 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global vars in different build scenarios.

We have a solution where one project contains a set of business rules. We
use the rules in a web application and they're integrated into the main web
project. Any global varaibles for the user are stored on the web session,
and that all works fine.

Now the fun part, we now have to be able to call these business rules from
an old powerbuilder app, where a web server isn't available, so have to use
a com interface layer to call the business rules. The problem is that we
need the com class to initialise some variables and make them available to
the rules class. I know there's not a session object, but how do you go
about coding for the two very different scenarios that the business object
will be living in?

Cheers
Adrian
Oct 7 '08 #1
2 1149
Adrian wrote:
We have a solution where one project contains a set of business rules. We
use the rules in a web application and they're integrated into the main web
project. Any global varaibles for the user are stored on the web session,
and that all works fine.

Now the fun part, we now have to be able to call these business rules from
an old powerbuilder app, where a web server isn't available, so have to use
a com interface layer to call the business rules. The problem is that we
need the com class to initialise some variables and make them available to
the rules class. I know there's not a session object, but how do you go
about coding for the two very different scenarios that the business object
will be living in?
I don't know exactly who said it, but it's a truism that there's no problem
in computing that can't be solved by adding an extra layer.

Create a new assembly and within it define a UserGlobals class to hold the
globals you need. Give it a static factory method to return the globals for
a particular user. The business object should use that method only to get at
the globals, and the only thing that's different is the way you
create/initialize these instances. You can check HttpContext.Current to see
if you're running in the context of a website (you can reference System.Web
from any .NET assembly, it doesn't need to be a website project). If so,
retrieve settings from the session, if not, get them some other way.

--
J.
Oct 8 '08 #2
Aha ok thanks Jeroen

"Jeroen Mostert" <jm******@xs4all.nlwrote in message
news:48*********************@news.xs4all.nl...
Adrian wrote:
>We have a solution where one project contains a set of business rules.
We use the rules in a web application and they're integrated into the
main web project. Any global varaibles for the user are stored on the
web session, and that all works fine.

Now the fun part, we now have to be able to call these business rules
from an old powerbuilder app, where a web server isn't available, so have
to use a com interface layer to call the business rules. The problem is
that we need the com class to initialise some variables and make them
available to the rules class. I know there's not a session object, but
how do you go about coding for the two very different scenarios that the
business object will be living in?
I don't know exactly who said it, but it's a truism that there's no
problem in computing that can't be solved by adding an extra layer.

Create a new assembly and within it define a UserGlobals class to hold the
globals you need. Give it a static factory method to return the globals
for a particular user. The business object should use that method only to
get at the globals, and the only thing that's different is the way you
create/initialize these instances. You can check HttpContext.Current to
see if you're running in the context of a website (you can reference
System.Web from any .NET assembly, it doesn't need to be a website
project). If so, retrieve settings from the session, if not, get them some
other way.

--
J.

Oct 8 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2013
by: flamesrock | last post by:
ok, so to my knowledge, object oriented means splitting something into the simplest number of parts and going from there. But the question is- when is it enough? For example I have the following...
4
1914
by: Kenny Ashton | last post by:
Hello gurus Can I ask you opions on the best compromise for storing Access Ado connection strings in a IIS4 standard ASP environment. For any method I use, there seems to be an article somewhere...
16
2260
by: WaterBug | last post by:
When clicking on the following link from an email i.e - http://myserver/myapplication/myprogram.asp?urlvar1=some%20stuff&urlvar2=more%20stuff I get a server 500 error. With that same browser...
17
5591
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
11
2530
by: Capstar | last post by:
Hi, I am working on an application, which will run embedded without an OS. The app is build up out of a couple of well defined parts. At first I wanted to keep those parts seperated and use...
10
2615
by: Kleenex | last post by:
Reason: I am working on an embedded project which has very limited memory (under 512 bytes, 60 or so of which is stack space), which translates into limited stack space. In order to save on stack...
41
10632
by: Miguel Dias Moura | last post by:
Hello, I am working on an ASP.NET / VB page and I created a variable "query": Sub Page_Load(sender As Object, e As System.EventArgs) Dim query as String = String.Empty ... query =...
9
8620
by: CDMAPoster | last post by:
About a year ago there was a thread about the use of global variables in A97: http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157 Best Practices by Kang...
0
1431
by: Gary Herron | last post by:
Jacob Davis wrote: Yuck, YUCK, YUCK! You are breaking *so* many good-programming-practices, I hardly know where to start. First off: A python global is not what you think. There are *no*...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.