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 2 1156
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.Cur rent 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.
Aha ok thanks Jeroen
"Jeroen Mostert" <jm******@xs4al l.nlwrote in message
news:48******** *************@n ews.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.Cur rent 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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 code:
#def put_file(file_id, delete=False):
# """ Function to put the file on the FTP Server
# """
# print " FTP for this file started"
|
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
that says 'never' do this, or that.
1. I have 3 site folders s1, s2, s2 and a common DB folder outside
the site roots.
/sites/s1
/sites/s2
|
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 window open, if I click
the link from the email again I get the desired page. The results are the
same if the url is copied and pasted into the brower but the 'go' must be
pressed twice.
It appears that the server is trying to resolve the url vars...
|
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 constantly running tests on imperfect code.
On of the cumbersome jobs encountered is reassigning global vars
their values after a close encounter with an untrapped runtime error.
Rather than writing a procedure to simply reassign them all with a...
|
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 opaque data types to
transfer information in between them.
At some stage I was stuck and needed to make a variable global, and I
also needed to make the struct declaration public to some other parts.
Looking through the code I found out that lots...
| |
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 space, I
tried to only use parameters and stack space for things which are truely
temporary. Instead of passing a pointer to a data structure which should
always be populated with data, I have the data structure declared as a
global variable and...
|
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 = String.Format("SELECT * FROM dbo.documents WHERE ") & query
End Sub
|
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 Su Gatlin, casual mention was made about using
static variables as an alternative to using global variables. This
caused me to think of the following:
'-----Begin module code
|
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*
program wide globals. There are only module wide globals. Also, the
"global isglobal" is absolutely meaningless as anything declared there
is a (module level) global by definition.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |