private List<InstanceInfo> ExecuteSelectInstancesCommand(SQLiteConnection connection, string sql) { List<InstanceInfo> result = new List<InstanceInfo>(); new SqlSelectCommand( connection, sql, reader => { InstanceVersion version = new InstanceVersion(reader[ServerInstanceDirectory.ServerInstanceVersionFn].ToString()); ServerProperties props = new ServerProperties( version, reader[ServerInstanceDirectory.ServerInstanceNameFn].ToString(), DateTime.Now ); AuthenticationInfo auth = new AuthenticationInfo { IsWindows = (bool) reader[LoginDirectory.IsWinAuthFn], Username = reader[LoginDirectory.LoginFn].ToString(), Password = this._cryptoService.Decrypt(reader[LoginDirectory.PasswordFn].ToString()) }; result.Add( new InstanceInfo(props) { Authentication = auth, Instance = reader[ServerInstanceDirectory.ConnectionNameFn].ToString(), IsEnabled = true, Name = reader[ServerInstanceDirectory.ConnectionNameFn].ToString(), DbType = reader[ServerInstanceDirectory.DbTypeFn].ToString(), IsODBC = (bool) reader[ServerInstanceDirectory.IsOdbcFn] } ); } ).Execute(100); return result; }
private InstanceInfo CreateFromRow(ServerInstanceRow instanceRow) { long loginId = instanceRow.LoginId; LoginRow loginRow = this._loginManager.GetLogin(loginId); AuthenticationInfo authInfo = new AuthenticationInfo { Username = loginRow.Login, Password = loginRow.Password, IsWindows = loginRow.IsWinAuth }; string conName = instanceRow.ConnectionName; InstanceInfo instanceInfo = new InstanceInfo(instanceRow.IsDynamicConnection) { Authentication = authInfo, IsODBC = instanceRow.IsOdbc, DbType = instanceRow.DbType, IsEnabled = true, Name = conName, Instance = conName }; instanceInfo.SetServerProperties( new ServerProperties( new InstanceVersion(instanceRow.ServerInstanceVersion), instanceRow.ServerInstanceName, DateTime.Now ) ); return instanceInfo; }