view Tools/DocGen/Content/Doc/Data/OpenConfig1.htm @ 9:1e85f66cf767 default tip

update bltoolkit
author nickolay
date Thu, 05 Apr 2018 20:53:26 +0300
parents f990fcb411a9
children
line wrap: on
line source

<% title # Configure using app.config %>
<% group # Configuration %>
<% order # 10 %>
<p class='j'>
Since Microsoft has released FW 2.0 and the <b>&lt;connectionStrings&gt;</b> section of
configuration file is available, it should be used. This configuration method is preferable.
The following method demonstrates this ability.
</p>
OpenConfig1FW2.cs
<% ..\..\..\HowTo\Data\OpenConfig1FW2.cs %>
App.config
<% Doc\Data\App1.config %>

<p class='j'>
In addition <b>BLToolkit</b> supports an alternative way which uses the <b>&lt;appSettings&gt;</b> section.
At the bottom of this page you can find a demo <a href='#cfg'>App.config</a> file with a few examples.
</p>
<p class='j'>
<b>BLToolkit</b> recognizes configuration strings in the <b>&lt;appSettings&gt;</b> section 
by looking for a <b>ConnectionString</b> key prefix. Actual key value can be the following:

<table class='data'>
<tr><th>key value</th><th>Provider</th><th>Configuration</th></tr>
<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>
<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>
<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>
<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>
<tr><td align='right'>or</td><td align='right'>'Foo' provider</td><td align='right'>default configuration</td></tr>
<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>
<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>
</table>

Default provider is <b>SqlDataProvider</b>.
See also <a href='DataProvider/index.htm'>Data Providers</a>.
</p>

OpenConfig1.cs
<% ..\..\..\HowTo\Data\OpenConfig1.cs %>
<a name='cfg'/>App.config
<% ..\..\..\UnitTests\All\App.config %>

<p class='j'>The default configuration can be set by a configuration file:</p>
App.config
<% Doc\Data\App2.config %>

<a href="CreateSql.htm">Create.sql script</a>