| 
0
 | 
     1 <% title # Configure using app.config %>
 | 
| 
 | 
     2 <% group # Configuration %>
 | 
| 
 | 
     3 <% order # 10 %>
 | 
| 
 | 
     4 <p class='j'>
 | 
| 
 | 
     5 Since Microsoft has released FW 2.0 and the <b><connectionStrings></b> section of
 | 
| 
 | 
     6 configuration file is available, it should be used. This configuration method is preferable.
 | 
| 
 | 
     7 The following method demonstrates this ability.
 | 
| 
 | 
     8 </p>
 | 
| 
 | 
     9 OpenConfig1FW2.cs
 | 
| 
 | 
    10 <% ..\..\..\HowTo\Data\OpenConfig1FW2.cs %>
 | 
| 
 | 
    11 App.config
 | 
| 
 | 
    12 <% Doc\Data\App1.config %>
 | 
| 
 | 
    13 
 | 
| 
 | 
    14 <p class='j'>
 | 
| 
 | 
    15 In addition <b>BLToolkit</b> supports an alternative way which uses the <b><appSettings></b> section.
 | 
| 
 | 
    16 At the bottom of this page you can find a demo <a href='#cfg'>App.config</a> file with a few examples.
 | 
| 
 | 
    17 </p>
 | 
| 
 | 
    18 <p class='j'>
 | 
| 
 | 
    19 <b>BLToolkit</b> recognizes configuration strings in the <b><appSettings></b> section 
 | 
| 
 | 
    20 by looking for a <b>ConnectionString</b> key prefix. Actual key value can be the following:
 | 
| 
 | 
    21 
 | 
| 
 | 
    22 <table class='data'>
 | 
| 
 | 
    23 <tr><th>key value</th><th>Provider</th><th>Configuration</th></tr>
 | 
| 
 | 
    24 <tr><td><span class='kw'>key</span>=<span class='str'>"ConnectionString"</span></td><td align='right'>default provider</td><td align='right'>default configuration</td></tr>
 | 
| 
 | 
    25 <tr><td><span class='kw'>key</span>=<span class='str'>"ConnectionString.Foo.Bar"</span></td><td align='right'>'Foo' provider</td><td align='right'>'Bar' configuration</td></tr>
 | 
| 
 | 
    26 <tr><td><span class='kw'>key</span>=<span class='str'>"ConnectionString.Foo."</span></td><td align='right'>'Foo' provider</td><td align='right'>default configuration</td></tr>
 | 
| 
 | 
    27 <tr><td><span class='kw'>key</span>=<span class='str'>"ConnectionString.Foo"</span></td><td align='right'>default provider</td><td align='right'>'Foo' configuration</td></tr>
 | 
| 
 | 
    28 <tr><td align='right'>or</td><td align='right'>'Foo' provider</td><td align='right'>default configuration</td></tr>
 | 
| 
 | 
    29 <tr><td><span class='kw'>key</span>=<span class='str'>"ConnectionString..Foo"</span></td><td align='right'>default provider</td><td align='right'>'Foo' configuration</td></tr>
 | 
| 
 | 
    30 <tr><td><span class='kw'>key</span>=<span class='str'>"ConnectionString..Foo.Bar"</span></td><td align='right'>default provider</td><td align='right'>'Foo.Bar' configuration</td></tr>
 | 
| 
 | 
    31 </table>
 | 
| 
 | 
    32 
 | 
| 
 | 
    33 Default provider is <b>SqlDataProvider</b>.
 | 
| 
 | 
    34 See also <a href='DataProvider/index.htm'>Data Providers</a>.
 | 
| 
 | 
    35 </p>
 | 
| 
 | 
    36 
 | 
| 
 | 
    37 OpenConfig1.cs
 | 
| 
 | 
    38 <% ..\..\..\HowTo\Data\OpenConfig1.cs %>
 | 
| 
 | 
    39 <a name='cfg'/>App.config
 | 
| 
 | 
    40 <% ..\..\..\UnitTests\All\App.config %>
 | 
| 
 | 
    41 
 | 
| 
 | 
    42 <p class='j'>The default configuration can be set by a configuration file:</p>
 | 
| 
 | 
    43 App.config
 | 
| 
 | 
    44 <% Doc\Data\App2.config %>
 | 
| 
 | 
    45 
 | 
| 
 | 
    46 <a href="CreateSql.htm">Create.sql script</a>
 |