Irwsoft Data Framework

Default Connection
Brief Information
EditionsProfessional and Ultimate
ProvidersAll Providers.
DataschemaTable, View, Function and Procedure.
TopicsUsing Default Connection.
RemarksBy using Default Connection, you don't need to specify connection string for each query.

Default connection is connection information that put into attribute of data schema class. This information will be used by a sql object mapper to connect to the database. By setting default connection you do not need to set connection string for each query.


There are two ways to set default connection :

  • ConnectionName. This name will refer to name of connection-string in application configuration file.

  • ConnectionString. Provides connection string information.


Example :

Person data schema class with ConnectionName specified in C# code
// 1) Specify ConnectionName property of Irwsoft.Data.TableAttribute
[Table("Person", ConnectionName="SqlServer2008.TestDb")]
public class PersonTable
{
     // ... fields & properties here

     public PersonTable()
     {
          Irwsoft.Data.DataFactories.InitTableSchema(this);
     }
}

// 2) Specify ConnectionName in application configuration inside connectionStrings section.
<connectionStrings>
     <add  name="SqlServer2008.TestDbconnectionString=" Data Source=.\SqlServer2008;Initial Catalog=TestDb;Integrated Security=True " />
</connectionStrings>

Person data schema class with ConnectionString specified in C# code
// 1) Specify ConnectionString property of Irwsoft.Data.TableAttribute
[Table("Person", ConnectionString= "Data Source=.\SqlServer2008;Initial Catalog=TestDb;Integrated Security=True;" )]
public class PersonTable
{
     // ... fields & properties here

     public PersonTable()
     {
          Irwsoft.Data.DataFactories.InitTableSchema(this);
     }
}
Irwsoft Data Ultimate Edition provides all enhanced features of Irwsoft Data Framework and support from irwsoft.