public void SaveApplicationData() { var folder = ConnectionsConfigurationNode; foreach (var subFolder in folder.ChildNodes) { var connectionProperties = new ConnectionProperties(); connectionProperties.Load(subFolder); var dbConnectionStringBuilder = new DbConnectionStringBuilder(); dbConnectionStringBuilder.ConnectionString = connectionProperties.ConnectionString; object obj; var contains = dbConnectionStringBuilder.TryGetValue(ConnectionStringKeyword.UserId, out obj); if (contains) { var password = dbConnectionStringBuilder.GetValue(ConnectionStringKeyword.Password); dbConnectionStringBuilder.Remove(ConnectionStringKeyword.Password); connectionProperties.ConnectionString = dbConnectionStringBuilder.ConnectionString; password = ConnectionProperties.ProtectPassword(password); subFolder.Attributes.SetAttributeValue(ConnectionStringKeyword.Password, password); } connectionProperties.Save(subFolder); } var tempFileName = FileName + ".temp"; ApplicationData.Save(tempFileName, _sectionName); var succeeded = NativeMethods.MoveFileEx(tempFileName, FileName, NativeMethods.MoveFileExFlags.ReplaceExisiting); Log.Write(LogLevel.Trace, "MoveFileEx succeeded: {0}", succeeded); }