S2Container.NET after version 1.1 supports database connection.
When using S2Tx.NET, transaction is maintained even after connection is open and closed several times.
Transaction may, also, be processed using Aspect.
Setup
Configure DataProvider and TxDataSource.
Seasar.Extension.ADO.DataProvider
Property
Description
Example
ConnectionType
Retrieve class name of .NET Framework data provider that implements System.Data.IDbConnection interface.
Required
"System.Data.SqlClient.SqlConnection"
CommandType
Set class name of .NET Framework that implements System.Data.IDbCommand interface.
Required
"System.Data.SqlClient.SqlCommand"
ParameterType
Set class name of .NET Framework data provider that implements System.Data.IDbParameter interface.
Required
"System.Data.SqlClient.SqlParameter"
DataAdapterType
Set class name of .NET Framework data provider that implements System.Data.IDbDataAdapter interface.
Required
"System.Data.SqlClient.SqlDataAdapter"
Seasar.Extension.Tx.Impl.TxDataSource
Property
Description
Example
DataProvider
Specify DataProvider instance name. When specifying from a S2Container, specify DataProvider component name.
Required
SqlClient
ConnectionString
Connection string to connect to a database. String to set to System.Data.IDbConnection.ConnectionString.
Required Note: Use "\\" to denote "\".
For example, to connect to an instance of SQL Server 2005, use "computer name\\instance name".
To use .NET Framework data provider other than .NET Framework data provider for SQL Server, it is necessary to specify .NET Framework data provider assembly in <seasar> configuration section in the application configuration file.
App.config
<configuration><configSections><sectionname="seasar"type="Seasar.Framework.Xml.S2SectionHandler, Seasar"/></configSections><seasar><assemblys><!-- needed when using .NET Framework Data Provider for Oracle --><assembly>System.Data.OracleClient, version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</assembly><!-- needed when using Firebird .NET Data Provider --><!-- <assembly>FirebirdSql.Data.Firebird, Version=1.7.0.1, Culture=neutral, PublicKeyToken=fa843d180294369d</assembly> --></assemblys></seasar></configuration>