Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

TypedDataSetUtils Class

Using reflection on VS.NET 2005 a generated typed dataset, apply the connection/transaction pair associated with the current Spring based transaction scope.

For a list of all members of this type, see TypedDataSetUtils Members .

System.Object
   TypedDataSetUtils

[Visual Basic]
Public MustInherit Class TypedDataSetUtils
[C#]
public abstract class TypedDataSetUtils

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

This avoids the limitations of using System.Transaction based transaction scope for multiple operation on typed datasets withone one transaction. Reflection was used rather than partial classes to provide a general solution that can be written and applied once. Usage within a DAO method, FindAll() is shown below. Note: Convenience methods to simplify calling syntax maybe provided in the future, it is a trade off on type safety calling the typed adapter defined outside the anonymous method as compared to casting inside a "DoInDbAdapter(object dbAdapter) method.

 public PrintGroupMappingDataSet FindAll()
 {

    PrintGroupMappingTableAdapter adapter = new PrintGroupMappingTableAdapter();
    PrintGroupMappingDataSet printGroupMappingDataSet = new PrintGroupMappingDataSet();
        
        
    printGroupMappingDataSet = AdoTemplate.Execute(delegate(IDbCommand command)
                               {
                                   TypedDataSetUtils.ApplyConnectionAndTx(adapter, command);
                                   adapter.Fill(printGroupMappingDataSet.PrintGroupMapping);
                                   return printGroupMappingDataSet;
                               }) 
                               as PrintGroupMappingDataSet;

    return printGroupMappingDataSet;
 }
 
See http://www.code-magazine.com/articleprint.aspx?quickid=0605031 for a more complete discussion.

Requirements

Namespace: Spring.Data.Support

Assembly: Spring.Data (in Spring.Data.dll)

See Also

TypedDataSetUtils Members | Spring.Data.Support Namespace