>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.
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