Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing Business Object and there fields
Message
 
À
02/07/2004 05:09:31
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00920029
Message ID:
00920738
Vues:
17
Shai,

>I wanted to work with my Business Object directly , not in Win/Web form. ( to manipulate the Data, do batch updates , Run statistics about the records etc.)

>How can I work with the object as BO for example:
>
>Orders oOrders = new Orders();
>oOrders.GetAllOrders()

The most efficient way is have your GetAllOrders method return a DataSet and cycle through it. For example:
DataSet ds = this.oOrder.GetCurrentDataSet();
foreach(DataRow dr in ds.Tables["MyTable"].Rows)
{

}
This is perfectly valid since the DataSet is a data-neutral container (not specific to the back end). You can even take this a step further by using typed DataSets.

However, if you want to add another layer of abstraction and put properties on your business object rather than working directly with the data returned by the business object, you'll add some overhead, but you can encapsulate the business object's internal DataSet by implementing the IEnumerator interface on your business object so consumers can iterate over it using foreach.

For details, see the .NET Help topic "Using foreach with Collections".

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform