ORM Sample Class Library

DataManagerBase.PopulateObjectsFromDataSet Method 

Merges a given dataset into the DataManagers underlying dataset, so that objects may be avalable via the Get<Object>FromDataSet(PKey) signature.

[Visual Basic]
Public Sub PopulateObjectsFromDataSet( _
   ByVal ds As DataSet, _
   ParamArray orderedTableList As String() _
)
[C#]
public void PopulateObjectsFromDataSet(
   DataSet ds,
   params string[] orderedTableList
);

Parameters

ds
The dataset to merge from
orderedTableList
a list of table mappings

Remarks

The function will match the array of tables in the given dataset with the list of table names by there ordinal. i.e. ds.Tables[0] will be imported as the first of orderedTableList ds.Tables[1] will be the second.....

Example

DataManager dm = new DataManager(Config.Dsn);

// Execute some sql that returns table(s) or any other way to retrieve a dataset (webService?)
DataSet ds = dm.FillDataSet("select * from  Contact where id = 10055",typeof(DataSet));

// merge the data into DataManager
dm.PopulateObjectsFromDataSet(ds,"Contact");

Contact c = dm.GetContactCollectionFromDataSet()[0];
Console.WriteLine(c.Address1);

See Also

DataManagerBase Class | OrmLib Namespace


eTopic.htm">Finalize (inherited from Object)Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.