Ответ на вопрос в предыдущем комментарии.
private static void InitConnectSetting() {
Configuration config = ConfigurationManager.
OpenExeConfiguration(ConfigurationUserLevel.None);
var path = DebugMode ? DebugModeDbPath() : Application.StartupPath;
Dictionary<string, string> db = new Dictionary<string, string>() {
{"ec", string.Format("{0}\\db\\{1}", path, /*DebugMode ? "data.db" : */"data.db")},
};
var conSets = config.ConnectionStrings;
foreach (var key in db.Keys) {
var sName = key + "Entities";
var conSet = conSets.ConnectionStrings[sName];
if (conSet != null)
conSets.ConnectionStrings.Remove(conSet);
conSet = new ConnectionStringSettings();
conSet.ProviderName = "System.Data.EntityClient";
conSet.Name = sName;
conSet.ConnectionString =
string.Format("metadata=res://*/{0}Model.csdl|res://*/{0}Model.ssdl|res://*/{0}Model.msl;" +
"provider=System.Data.SQLite;" +
"provider connection string=\"data source={1}\"", key, db[key]);
conSets.ConnectionStrings.Add(conSet);
var file = new FileInfo(db[key]);
if (false && !file.Exists) {
using (BinaryWriter binWriter =
new BinaryWriter(File.Open(db[key], FileMode.Create))) {
switch (key) {
case "ec":
binWriter.Write(Properties.Resources.kladr, 0, Properties.Resources.kladr.Length);
break;
}
}
}
}
conSets.SectionInformation.ForceSave = true;
conSets.SectionInformation.RequirePermission = false;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection(conSets.SectionInformation.Name);
}
UPD: При запуске предлагать выбрать бд а затем изменять строки подключения.