Re: Help ! -> Distributed BL and Database Access
- From: "GoogleEyeJoe" <crgsmrt@xxxxxxxxxxx>
- Date: 5 Sep 2006 09:28:15 -0700
Its ok I think I've solved my problem. I designed the use of the
database connection incorrectly.
crgsmrt@xxxxxxxxxxx wrote:
Hello all,
I'm working on a project that requires the use of distributed
notifications between machines. I.e. an update is made by one machine
and then another machine is notified of the change (subscriber
pattern).
As this is my first attempt with Remoting I'd really appreciate if
someone could offer some much needed advice. I cannot appear to make my
mind up regarding a choice and if anyone can point in the right
direction I'd really appreciate it.
Basically, I have one server located in a remote part of the country
and multiple clients that will be scattered across the country. I'd
ideally like to have all business objects supplied by a form of factory
on the server and then when an object calls it's associated 'save'
method the data within the object will be comitted to the database. To
do this I thought of ...
1. Create a business logic object on the server, issue it with a a
reference to the database connection and then send it to the client (by
value - to move the work off onto the client). Therefore, when the
client finishes work on the object and invokes its 'save' method the
object uses the reference to the (remote) database connection it has to
execute several stored procedures. The reason I want to have the object
copied across onto the client is to take the workload away from the
server (to assist in future expansion). Is this a bad idea? As all
objects will have only a single reference to a database connection will
this cause a delay when multiple clients execute queiries on the
database at the same time - as I would imagine there would be no use of
connection pooling - as 1 connection reference would be shared between
multiple clients...
this is where it gets a little wierd...
2. Rather than having the server produce objects and send them to the
client, the client object (which hides functionality from the user
interface) creates instances of the business objects (instead of the
server creating them and dishing them out) and uses its own database
connection (created by the client object) to commit data (i.e. pass
this to the business objects, rather than a connection from the
server). The only issue I have with this is that I need to manually
generate primary keys (for a form of purchase order). The only way I
could think of achieving this is to execute a method on a
singleton-type object on the server machine to get the next order
number (in doing so the object would connect to the database, get the
next id, write an entry into the database and return the new id as a
result of the remote call) However, my gut feeling is that this is not
right as I have to entry points into the database...
Please will someone offer some much needed guidance.
Many thanks in advance. A very confused...
Craig.
.
- References:
- Help ! -> Distributed BL and Database Access
- From: crgsmrt
- Help ! -> Distributed BL and Database Access
- Prev by Date: Re: Locating remote assemblies
- Next by Date: Simple sandboxing with appdomain
- Previous by thread: Help ! -> Distributed BL and Database Access
- Next by thread: Remoting or WCF
- Index(es):
Relevant Pages
|