.netSavant Data Access Adapter Examples

We've compiled a few samples to help get you started using the adapters that .netSavant creates. You'll find examples for each of the major execution methods included as well as a simple example illustrating adapter use within the context of a transaction.

ExecuteEnumerator

ExecuteEnumerator provides a highly efficient method for execution and will be the method that you call most often to execute statements. Because this method returns IEnumerable<DbDataReader>, you will need to use ExecuteReader to gain access to provider specific data types.

view the sample

ExecuteReader (stateless)

When you need access to provider specific data types (UDT, Binary, etc.) the overloaded ExecuteReader methods expose provider specific DbDataReader objects through the use of a delegate.

view the sample

ExecuteReader (stateful)

As with the stateless ExecuteReader overload, the stateful version gives you access to a provider specific DbDataReader object. Unlike the stateless overload this version allows you to pass data into the delegate method to perform a myriad of tasks. This method is most commonly used when building collections of objects that require access to provider specific data types.

view the sample

Fill (DataSet / DataTable)

The fill method simply wraps the standard functionality used when executing a statement with standard ado.net. This method is most appropriate for use in systems that make use of DataSet and DataTable objects for access to data.

view the sample

Transaction Support

Using either an overloaded constructor or the AttachTransaction(Transaction) method, all generated adapters can participate in a standard ado.net transaction.

view the sample