N-Tier Architecture

  • Thread starter Thread starter Islamegy®
  • Start date Start date
I

Islamegy®

Lately i started to use microsoft code block and read about N-tier model..
I got some templates which implement custom collection for each database
table, I used to use DataTable and DataView in my programs so the Entity is
Datarow or Datarowview and the collection is the Dataview it self..

This way i was able to do all tasks without go back to the database, i was
searching with findRows or use RowFilter to search using "Like" and other
sql expression [i notes later in my first windows application that RowFilter
is really slow in preformance].

For what reason people need to implement custom collections and write all
this code to reimplement something already exist!!
thanx
 
But You will have to write alot of code.. and implement something like
RowFilter is really hard.. how could i search for a Customer in
CustomerCollection with a part of the firstname (Like) or range of date
(Between) in custom collection..
say i want to use (like) expression then i must loop on my collection
implement search kind of
str.indexOf(input.ToString());
to return this customer if index >= 0;
Is this efficient way (from preformance view) if i have 500 customers in my
collection and better than using implemented Datatable and Dataview
methods??
thanx
 
I have an article which talks about custom entities in a fair amount of
details:
http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/CustEntCls.asp

There's no doubt that you are right, you'll need to re-write a lot of the
code which the DataTables already have built-in. There are frameworks such
as CSLA.Net (http://www.lhotka.net/ArticleIndex.aspx?area=CSLA .NET) which
provide a lot of that core functionality. Additionally, you can use Code
Generators such as CodeSmith (www.codesmithtools.com) to automatically
generate a lot of the code for you.

Let's not forget, you can still use your data layer to *gasp* access the
data. DataTable's SELECT might be good, but it's no where as good as SQL
Server's. w

Karl
 
Custom collections for each table violates the layer of abstraction that
needs to exist between the Object Oriented and Relational elements of your
project. It also over-complicates it and makes change management a
nightmare.

Do not put raw SQL in compiled code. The bulk of all business logic belongs
in the data layer - use stored procedures. Also it is generally better to
filter result sets servier-side.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top