Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / August 2007

Tip: Looking for answers? Try searching our database.

Strongly Typed Dataset should be in DataAccess Layer or Business Layer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kittipong.kiatcheeranun@gmail.com - 29 Aug 2007 02:06 GMT
I am not exactly sure that my understanding is right or wrong. In
strongly typed dataset we can generate all of the fields from tables
in database and also has tableadapter that allow us to write down sql
command in or directly link to table. We still can write the code in
dataset partial class for validating data as well.
As far as I understand strongly typed dataset is in both of Business
layer and data access layer, isn't it? Because validation rules code
and all datatable's fields should be in business layer and
tableadapter which is tied to sql command and connection string should
be in data access layer. Is this right or wrong? Any suggestion or
does it have any best way if I want to use strongly typed dataset in
my project.
Cor Ligthert[MVP] - 29 Aug 2007 04:30 GMT
Kittipong,

It depends on the project, however I do it for larger project as you told.
However it is even possible to set your simple checkings in the field
descriptors in the SQL server, that is then exposed in the strongly typed
dataset which makes then an easy early check even automatically in the UI
possible, as it is about binded controls.

The cavatat of that is that it needs forever maintenance at the SQL server
side. I agree with you that this all does not make everything clear.

Cor

>I am not exactly sure that my understanding is right or wrong. In
> strongly typed dataset we can generate all of the fields from tables
[quoted text clipped - 8 lines]
> does it have any best way if I want to use strongly typed dataset in
> my project.
kittipong.kiatcheeranun@gmail.com - 29 Aug 2007 08:46 GMT
On Aug 29, 1:30 pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
> Kittipong,
>
[quoted text clipped - 23 lines]
> > does it have any best way if I want to use strongly typed dataset in
> > my project.

Thanks for the answer Cor. I still have a thing that confusing me. For
DataAccess Layer should it know about StronglyTyped dataset? For
example, I have a insert product method in my Data Access Layer as the
first method below:

1. First Method:
        public static int Insert(string productName, int categoryID, decimal
unitPrice)
        {
            Database myDatabase = DatabaseFactory.CreateDatabase();
            DBCommandWrapper myCommand =
myDatabase.GetStoredProcCommandWrapper("entlibProductsInsert");

            myCommand.AddInParameter("@ProductName", DbType.String,
productName);
            myCommand.AddInParameter("@CategoryID", DbType.Int32, categoryID);
            myCommand.AddInParameter("@UnitPrice", DbType.Currency, unitPrice);

            // Execute the query and return the new identity value
            return Convert.ToInt32(myDatabase.ExecuteScalar(myCommand));
        }

2. Second Method:
        public static int Insert(ProductDataSet productDataSet)
        {
            Database myDatabase = DatabaseFactory.CreateDatabase();
            DBCommandWrapper myCommand =
myDatabase.GetStoredProcCommandWrapper("entlibProductsInsert");

            myCommand.AddInParameter("@ProductName", DbType.String,
productName);
            myCommand.AddInParameter("@CategoryID", DbType.Int32, categoryID);
            myCommand.AddInParameter("@UnitPrice", DbType.Currency, unitPrice);

            // Execute the query and return the new identity value
            return Convert.ToInt32(myDatabase.ExecuteScalar(myCommand));
        }

In my case If I want to change parameter to be strongly typed dataset
as shown in my second method, do I need to move my strongly typed
dataset to DataAccess Layer or it should be separated in another
layer? What I am thinking I may put my strongly typed dataset in
another layer called Business Entity because the strongly typed needs
to share with DataAccess, Business and UI (binding control) as well.

I am not sure it's right or wrong and I don't really know how other
people do it, any suggestion will be really appreciated.

Regards,
Kittipong
Cor Ligthert[MVP] - 29 Aug 2007 18:23 GMT
kittipong,

Be aware that you never move an object between layers, you only give the
reference by value, therefore I like it very much to give the object that it
is about. In your case the strongly typed dataset.

Cor

> On Aug 29, 1:30 pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
> wrote:
[quoted text clipped - 79 lines]
> Regards,
> Kittipong
kittipong.kiatcheeranun@gmail.com - 30 Aug 2007 02:25 GMT
On Aug 30, 3:23 am, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
> kittipong,
>
[quoted text clipped - 89 lines]
> > Regards,
> > Kittipong

Thank for your answer cor. It helped me out a lot :). And I also skim
read through Patterns of Enterprise Applicaiton Architecture (Martin
Fowler) and MS Designing Data Tier Components and Passing Data Through
Tiers. These two books are great and answer a heap of my questions as
well.

Regards,
Kittipong

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.