469,362 Members | 2,603 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

Creating n-tier solution

In a current .Net solution (using VB.Net) has a 3 tier architecture of Web
interface, Data Access Layer and Database.

How do I implement business logic and class layers into this solution?
Nov 18 '05 #1
7 1961
We simply added a business layer to that approach which carries the business
logic and classes.

Web GUI
Business Layer
Data Access Layer
Database

"Robin" <ro*******@hotmail.com> wrote in message
news:eS**************@tk2msftngp13.phx.gbl...
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web
interface, Data Access Layer and Database.

How do I implement business logic and class layers into this solution?

Nov 18 '05 #2
Also, from what I understand the 3 Tier approach generalizes the division of
Presentation vs Application vs Data logic.

Can anyone confirm or correct this?

"Robin" <ro*******@hotmail.com> wrote in message
news:eS**************@tk2msftngp13.phx.gbl...
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web
interface, Data Access Layer and Database.

How do I implement business logic and class layers into this solution?

Nov 18 '05 #3
Create a new Project - Other Projects - Enterprise Template Projects - C# or VB Building Blocks - Then Create a Presentation layer, Business
Rules or Facade and a Data Access layer. Have the Presentation reference the Business, and the Business reference the Data - and make sure
you are super vigilant in putting the right stuff in the right layer. After a while it will become second nature.

Bobby Ryzhy
bobby@ domain below
http://weekendtech.net

On Thu, 15 Jul 2004 17:42:00 +0100, "Robin" <ro*******@hotmail.com> wrote:
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web
interface, Data Access Layer and Database.

How do I implement business logic and class layers into this solution?


Bobby Ryzhy
bobby @ domain below
http://weekendtech.net
Nov 18 '05 #4
3-tier is a bit misleading. You can have as many tiers as you logically
need. For example, we have a 5-tier model, which has a business layer
between the Interface and Data Access layers, and our presentation layer is
divided into 2 layers as well - one for presentation logic/HTML, and CSS for
presentation layout.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Robin" <ro*******@hotmail.com> wrote in message
news:eS**************@tk2msftngp13.phx.gbl...
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web
interface, Data Access Layer and Database.

How do I implement business logic and class layers into this solution?

Nov 18 '05 #5
Hi,

Strongly recommend to use any MVC II framework (UIP, Maverick) to not
just separate into layers but also decoupling layers.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6
Attached you will find a zip file. This is the Teired solutions that I use.

We have several large client of ours using this model and it works great.

There are 4 files using Inhertiance which makes it simpler (for me at least)
to keep maintained.

Base.vb - is a must inherit class that basically contains all the fields in
the database and the types. With a function that set a default value in the
fields.

DataAccess.vb - is a must inherit class which inherits the Base class (to
get all the properties) but it can have it own property usually readonly
and the results of joins. This class allow for the updating, deleting, and
create of a single record in the in the database. This also contain
multiple record results in the form of a strongly type collection to reduce
processing overhead and bytes transmitted. Strongly typed collection can
still be bound to anything accepting a .DataSource. Also contain several
function to manage the cache (creation and expiration) of results and items
from the database

BusinessLogic.vb - Inherits the DataAccess class and contains the Validate
function to validate the updates and creates going into the database.

Collection.vb - Custom Strong Type Collection used in the DataAccess to
return results. Contains two classes ...Item and ...ItemCollection
(generated by CodeSmart)

At first this looks like a lot of code to create each time however I have
taken this style of code and using a templated based generation tool called
CodeSmith I created a custom template so I can generate about 90% all the
code I need in about 15 seconds. But some the advantanages are:

- all the data is cache reducing data hits
- all cache expires at 100 seconds (you can change this)
- all cached in managed force updated data out of cache only if it meets
certain criteria.
- business logic is only written one time.
- Everything is strongly typed allowing you to referece (set/get) fields the
Instance.FieldName
- Strongly type collection are by my testing faster, more flexable, and
smaller than Dataset.
- And with CodeSmith it can be generate very very quickly.

I am sure this answer is over kill for your question, but maybe you will
find something else you like in there too.

BTW. Once you do all the VB files you can just create an Reference to the
dll and then...

If you it a data collection you can reference it directly

Gizmo.DataSource = [Root Name Space].Role.GetAllRole()
Gizmo.DataBind

Or by an instance for create, drop, update.

' For create
Dim oRole as New [Root Name Space].Role()
oRole.Description = ""
oRole.Inactive = False
oRole.Create 'Returns a new unique identifier value if you want it
'For Edit key represent the unique row identifier. BTW, remember validation
of the field is done in the class no need for it here.
Dim oRole as New [Root Name Space].Role(Key)
oRole.Description = "Updated Role Description"
oRole.Update 'Returns true or false on the successful completion of process

'For Delete key represent the unique row identifier
Dim oRole as New [Root Name Space].Role(Key)
oRole.Delete 'Returns true or false on the successful completion of process

'Throws an error if business logic encounters an error
Try
Dim oRole as New [Root Name Space].Role(Key)
oRole.Description = "Updated Role Description"
oRole.Update ' or can be .Create or .Delete
Catch e As Exception
'Handle you error here any way you want.
End Try

'To get data out, single record, say a form, key represent the unique row
identifier
Dim oRole as New [Root Name Space].Role(Key)
txtDescription.Text = oRole.Description
cbxInactive.Check = oRole.Inactive

Somewhat straight forward.
-Wayne




"Robin" <ro*******@hotmail.com> wrote in message
news:eS**************@tk2msftngp13.phx.gbl...
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web
interface, Data Access Layer and Database.

How do I implement business logic and class layers into this solution?



Nov 18 '05 #7
Using following n-tier, database, DAL, class, business logic and Asp.Net,
how do you return class data/data set to the Asp.Net Layer to display all
the data?

As the class and DAL layers are not visible at the Asp.Net layer.

"Marc Castrechini" <mc@merchantwareh4o3u2s1e.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
We simply added a business layer to that approach which carries the business logic and classes.

Web GUI
Business Layer
Data Access Layer
Database

"Robin" <ro*******@hotmail.com> wrote in message
news:eS**************@tk2msftngp13.phx.gbl...
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web interface, Data Access Layer and Database.

How do I implement business logic and class layers into this solution?


Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Pawan | last post: by
2 posts views Thread by LIN | last post: by
12 posts views Thread by Mats Lycken | last post: by
15 posts views Thread by David Thielen | last post: by
7 posts views Thread by Gladiator | last post: by
9 posts views Thread by =?Utf-8?B?YmJn?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.