The Hydrus DataSet Toolkit

MultiTableDataAdapter Members

MultiTableDataAdapter overview

Public Instance Constructors

MultiTableDataAdapter Constructor Create a new MultiTableDataAdapter. This class must be registered with a CommandBuilder before use.

Public Instance Properties

AcceptChangesDuringFill (inherited from DataAdapter) Gets or sets a value indicating whether AcceptChanges is called on a DataRow after it is added to the DataTable during any of the Fill operations.
Container (inherited from Component) Gets the IContainer that contains the Component.
ContinueUpdateOnError (inherited from DataAdapter) Gets or sets a value that specifies whether to generate an exception when an error is encountered during a row update.
MissingMappingAction (inherited from DataAdapter) Determines the action to take when incoming data does not have a matching table or column.
MissingSchemaAction (inherited from DataAdapter) Determines the action to take when existing DataSet schema does not match incoming data.
Site (inherited from Component) Gets or sets the ISite of the Component.
TableMappings (inherited from DataAdapter) Gets a collection that provides the master mapping between a source table and a DataTable .

Public Instance Methods

CreateObjRef (inherited from MarshalByRefObject) Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
Dispose (inherited from Component)Overloaded. Releases all resources used by the Component.
Equals (inherited from Object) Determines whether the specified Object is equal to the current Object.
FillOverloaded. Fills every table in the DataSet provided.
FillAndFindRowOverloaded. Retrieves a particular row from a given table based on the given primary key value(s).
FillSchema This method is not implemented.
GetFillParameters This method is not implemented.
GetHashCode (inherited from Object) Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetLifetimeService (inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the lifetime policy for this instance.
GetType (inherited from Object) Gets the Type of the current instance.
InitializeLifetimeService (inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for this instance.
ToString (inherited from Component) 
UpdateOverloaded. This is the primary way the DataSet is kept in a consistent state with its data provider. When rows have been changed or added to the DataSet, a call to update changes will perform the necessary operations to save those changes to the data provider.
[c#]
using System.Data;
using Hydrus.DataSetToolkit;

public class SimpleBank
{
    MultiTableDataAdapter hydrusAdapter = new MultiTableDataAdapter();    
    CommandBuilder hydrusBuilder = new CommandBuilder(hydrusAdapter,
        Properties.Settings.Default.SqlConnectionString,
        "System.Data.SqlClient")
    
    MyCompany.MyDataSet dataSet = new MyCompany.MyDataSet();
    
    public bool TryDepositForUser(int userID, double amount)
    {
        DbTransaction tran = cmdFactory.CreateConnection().BeginTransaction(IsolationLevel.RepeatableRead);
        MyCompany.MyDataSet.UserRow modifiedUserRow = dataHelper.FillAndFindRow(dataSet.User,tran,userID);
        hydrusAdapter.Fill(dataSet.Account,tran,new ValueWhereConstraint(dataSet.SavingsAccount.UserID,modifiedUserRow.UserID));
        dataSet.Account[0].Balance += amount;
        modifiedUserRow.LastDepositAmount = amount;
        modifiedUserRow.LastDepositDate = DateTime.Now;
        try
        {
            hydrusAdapter.Update(dataSet, ref tran, true);
            return true;
        }
        catch (Exception ex)
        {
            Console.WriteLine("Commit Exception Type: {0}", ex.GetType());
            Console.WriteLine("  Message: {0}", ex.Message);
            // Attempt to roll back the transaction.
            try
            {
                tran.Rollback();
            }
            catch (Exception ex2)
            {
                // This catch block will handle any errors that may have occurred
                // on the server that would cause the rollback to fail, such as
                // a closed connection.
                Console.WriteLine("Rollback Exception Type: {0}", ex2.GetType());
                Console.WriteLine("  Message: {0}", ex2.Message);
            }
        }
        return false;
    }
}

Public Instance Events

Disposed (inherited from Component) Adds an event handler to listen to the Disposed event on the component.
Filled Event fired when underlying DataSet Filled event is fired
FillError 
Filling Event fired when underlying DataSet Filling event is fired
RowUpdated Event fired when underlying DataSet RowUpdated event is fired
RowUpdating Event fired when underlying DataSet RowUpdating event is fired
UpdatedChanges Event fired when underlying DataSet is updated with update changes
UpdatedDeletes Event fired when underlying DataSet is updated with delete changes.
UpdatingChanges Event fired before underlying DataSet is updated with update changes
UpdatingDeletes Event fired before underlying DataSet is updated with delete changes

Protected Instance Properties

DesignMode (inherited from Component) Gets a value that indicates whether the Component is currently in design mode.
Events (inherited from Component) Gets the list of event handlers that are attached to this Component.

Protected Instance Methods

CloneInternals (inherited from DataAdapter)Obsolete. Creates a copy of this instance of DataAdapter.
CreateTableMappings (inherited from DataAdapter) Creates a new DataTableMappingCollection .
DisposeOverloaded. Releases the resources used by the Component.
FillAndFindRowWithoutCommit Fills the table indicated by the keyConstraint, and returns a row matching the values.
Finalize (inherited from Component) Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.
GetService (inherited from Component) Returns an object that represents a service provided by the Component or by its Container.
MemberwiseClone (inherited from Object) Creates a shallow copy of the current Object.
OnFillError 
ShouldSerializeTableMappings (inherited from DataAdapter) Determines whether one or more DataTableMapping objects exist and they should be persisted.

See Also

MultiTableDataAdapter Class | Hydrus.DataSetToolkit Namespace | CommandBuilder | IWhereConstraint