Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 15th, 2006, 02:30 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default Seperating Layers

Hi all,
I am just trying to impliment this archetecture in my own site.
I dont quite understand how to seperate these layers.
How does the DAL gain access to its providers stipulated in the Design Tier Config file???
Many Thanks.
Rod

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
  #2 (permalink)  
Old August 15th, 2006, 11:27 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just search for the key in the code to see how he's using it.

Frankly I'm not a firm believer in using plugable DBMS providers unless you are serious about supporting more than 1 kind of DBMS. But then all of your SQL needs to be portable, or else you need several sets of SQL. All of this is ugly and adds nothing useful if you know you'll always be using SQL Server.

Don't confuse separation-of-tiers with the concept of a pluggable provider. The DBMS provider issue only affects the DAL. Ideally the higher tiers wouldn't need to know which DBMS you're using. But the would of databases isn't exactly ideal. Consider SQL paging for example: your business tier has to know how this is going to work so it requires knowledge of the DBMS.

Eric

  #3 (permalink)  
Old August 15th, 2006, 11:42 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Hi Englere,
Thanks for your reply.
This is a bit of a excersize for me at the moment, so Im not too concerned about the practise of changing DB's.
Although I do whish to make an app that I would expect to install in different environments within the same industry.
So I expect that they will all have the same type of data on hand somehwere, but in differing structures and db's.

My real concern was that I could not access the Config file from the seperated BLL as it is part of hte design layer.
I have since worked out that I can but I must specify that it is a Web App, which is not ideal for me.
I want to be able to save a "Person" record from the BLL and have any GUI impliment that Person object.

Am I correct that I would have to write a differing BLL depending on the GUI used?
How can I abstract the GUI so that I can reuse all my BL.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #4 (permalink)  
Old August 17th, 2006, 11:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to go with an Interface-based design if you really want DBMS independence. I'm still not sure if you understand how hard it is to support multiple options like SQL Server and Oracle, but if your needs are trivial you can use the OleDbProvider.

If your needs are advanced you are going to wish you never went down that road. I use both SQL Server and Oracle and I can't tell you how hard it is to keep the SQL performant, and also portable. You really end up duplicating your SQL so it can be tuned independently. The idea of "one size fits all" SQL is definitely not workable unless your needs are very basic.

There are many ways to specify a provider. If you were desparate you could even do it in machine.config, since that's available to all .NET classes on the computer.

Or checkout the Configuration application block that's part of the Enterprise Library. By the way, you'll learn a ton by studying the source code of that library.

Eric

  #5 (permalink)  
Old August 18th, 2006, 01:05 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Thanks Englere.
I'll take another look at my needs for the database.
So I can use machine.config for a web app?????


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #6 (permalink)  
Old August 21st, 2006, 10:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can use machine.config for any kind of .net application, including class libraries. But you can also use any config file of your choice (you can easily load an .xml file yourself), or the registry. I don't care much for the registry because of deployment difficulties.

Hosted websites won't give you access to machine.config or the registry, so you'd need to use your own config file in that case.

I made a singleton configuration class for my company that prevents it from being loaded more than once per app domain - this is a performance boosting benefit. I also added support for encrypting/decrypting sensitive values.

Be advised that if you use your own xml file you should treat it entirely as readonly to avoid any threading problems. Or else you can write your own code to do thread locking if you need to write to it from an application that might have multiple users writing at the same time.

You can read more about Singleton here - I strongly recommend option 5:
http://www.yoda.arachsys.com/csharp/singleton.html

Eric

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seperating Tickers keithd Excel VBA 1 January 28th, 2007 07:12 PM
Seperating a cell reverand Excel VBA 2 November 14th, 2006 11:46 PM
Seperating Date part from a datetime field ctranjith SQL Server 2000 2 October 25th, 2004 06:42 AM
Different Exception between 2 layers Janjan C# 0 February 28th, 2004 12:55 AM
Parameters Across Layers shabeeriqbal VB Components 0 February 11th, 2004 11:28 PM



All times are GMT -4. The time now is 12:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.