protected void CallOpen() { if (m_connFact == null) { Opened(null); return; } m_conn = ConnPack.GetConnection(m_connFact, true); if (ConnPack.IsOpened(m_connFact)) { Opened(null); } else { m_conn.BeginOpen(Async.CreateInvokeCallback(m_invoker, Opened)); } }
public override void GetAppObjectProperties(Dictionary <string, string> props) { base.GetAppObjectProperties(props); if (ConnPack != null) { var conn = ConnPack.GetConnection(Connection, false); if (conn != null && conn.Dialect != null) { props["dialect"] = conn.Dialect.DialectName; } else { props["dialect"] = GenericDialect.Instance.DialectName; } } if (Connection != null) { props["server"] = Connection.GetDataSource(); } }
protected override void DoRun(IJobRunEnv env) { IPhysicalConnection dbconn = null; if (m_dataFrame.TabularData.Connection != null) { ConnPack.GetConnection(m_dataFrame.TabularData.Connection.PhysicalFactory, false); Async.SafeOpen(dbconn); } Place.ProgressInfo = ProgressInfo; Generator.ProgressInfo = ProgressInfo; var holder = new ExtendedFileNameHolderInfo { DirectionIsSave = true, FileExtension = "sql", Filter = "*.sql|{s_sql_script} (*.sql)", RelatedConnection = m_dataFrame.TabularData.Connection != null ? m_dataFrame.TabularData.Connection.PhysicalFactory : null, RelatedDatabase = m_dataFrame.TabularData.DatabaseSource != null ? m_dataFrame.TabularData.DatabaseSource.DatabaseName : null, }; Place.SetFileHolderInfo(holder); string fn = Place.GetWorkingFileName(); using (var tw = new StreamWriter(fn)) { m_dmp = (Dialect ?? (dbconn != null ? dbconn.Dialect : null) ?? m_dataFrame.TabularData.Dialect ?? GenericDialect.Instance).CreateDumper(tw, FormatProps); if (Generator.IsRowEnumerator) { m_rows.LoadAllRows(ForEachRow); } else { Generator.GenerateSql(m_dmp); } } Place.FinalizeFileName(); }
void HConnection_RemoveByKey(RemoveConntectionByKeyArgs e) { if (ConnPack == null) { return; } if (!ConnPack.Contains(e.ConnKey)) { return; } if (!AllowCloseConnection(e.ConnKey)) { e.Canceled = true; return; } var async = ConnPack.BeginRemoveByKey(e.ConnKey, Async.CreateInvokeCallback(m_invoker, RemovedConnection)); if (async.CompletedSynchronously) { RemovedConnection(async); } }