したがって、それらはすべて、異なる接続文字列を除いて同じことを行います-「簡単」。
構成内で、「スキーマ」などの構成に新しいアプリ設定を作成し、値をコンマで区切ります。例:
<configuration>
<appSettings>
<add key="schema" value="connection1, connection2, connection3"/>
</appSettings>
</configuration>
次に、スキーマアプリ設定キーの各接続のキーがあることを確認します
<connectionStrings>
<add name="connection1" connectionString="your_connection_string" providerName="the_providor"/>
<add name="connection2" connectionString="your_connection_string" providerName="the_providor"/>
<add name="connection3" connectionString="your_connection_string" providerName="the_providor"/>
</connectionStrings>
OnStartで、次のようにします。スリープまたはスレッドのイテレーションを入れる必要があることを念頭に置いてください。
protected override void OnStart(string[] args)
{
string[] schemaList = ConfigurationManager.AppSettings["schema"].Split(",".ToCharArray());
foreach (string schema in schemaList)
{
// do your stuff...
}