1
A
回答
1
是,使用異步委託,如下實例闡述:
0
如果您只是希望它在後臺運行,那麼您可以將線程暫停或調用某些T-SQL來動態創建作業(並在之後再次將其刪除)。如果你想異步運行它,並且在完成時想要回調,那麼我認爲你很不幸運。
0
你是問,如果是1)合法的調用loadpackage在後臺線程或2)是否有可能。對於#1我不能給出明確的答案,因爲我不使用SSIS框架。
然而#2(只要#1是真的)肯定是可行的。恕我直言,你最好使用現有的框架,其API設計爲調用API的異步並等待結果。例如,如果使用Parellel Extensions June 08 CTP,以下代碼將會執行。
using System.Threading.Tasks;
...
var future = Future.Create(()=>LoadPackage); // Starts loading the package
// Do other stuff
var package = future.Value; // Wait for package load to complete and get the value
0
我正在通過異步WCF服務調用從我的用戶界面(WPF)調用SSIS包。服務代碼是:
public string ImportMarriageXML(bool isWakeUp, bool clearExistingMarriage)
{
try
{
var dts = new Microsoft.SqlServer.Dts.Runtime.Application();
using (var package = dts.LoadFromSqlServer(
ServiceSettings.Settings.SSIS.ImportMarriages,
ServiceSettings.Settings.SSIS.ServerIP,
ServiceSettings.Settings.SSIS.UserID,
ServiceSettings.Settings.SSIS.Password,
null))
{
package.InteractiveMode = false;
package.Connections["DB.STAGING"].ConnectionString = String.Format("{0};Provider={1};", DBSettings.ConnectionString(Core.Database.Staging), ServiceSettings.Settings.SSIS.Provider);
var variables = package.Variables;
variables["IsWakeUp"].Value = isWakeUp;
variables["ClearExistingMarriage"].Value = clearExistingMarriage;
variables["XmlDirectory"].Value = ServiceSettings.Settings.SSIS.Properties.XmlDirectory;
if (package.Execute() == DTSExecResult.Failure)
{
// HACK: Need to refactor this at some point. Will do for now.
var errors = new System.Text.StringBuilder();
foreach (var error in package.Errors)
errors.AppendFormat("SubComponent: {0}; Description: {1}{2}", error.SubComponent, error.Description, Environment.NewLine);
throw new ApplicationException(errors.ToString());
}
return package.Connections["Text Logging"].ConnectionString;
}
}
}
和(的一部分)的客戶端代碼如下:
private void InvokeLoadMarriages()
{
integrationServicesServiceClient.BeginImportMarriageXML(false, OnEndImportMarriageXML, null);
}
private void OnEndImportMarriageXML(IAsyncResult asyncResult)
{
view.InvokeDisplayResults(integrationServicesServiceClient.EndImportMarriageXML(asyncResult));
}
凡BeginImportMarriageXML & EndImportMarriageXML被中相應的代理類生成的異步操作。
相關問題
- 1. 將異步代碼包裝爲異步調用
- 2. SSIS中用於Web服務調用的異步腳本組件
- 3. 異步調用
- 4. 異步調用
- 5. 異步調用
- 6. 從.Net調用SSIS包
- 7. 異步調用和異步io調用之間的差異.net
- 8. 使異步調用同步
- 9. 同步異步API調用
- 10. 使異步調用同步
- 11. 包含異步調用和同步操作對結果的異步方法
- 12. 異步調用異步方法
- 13. 異步調用異步委託?
- 14. Anko異步API調用異步
- 15. 調試SSIS包 - debug.writeline
- 16. 當作爲SQL中的步驟調用時,SSIS包不運行
- 17. 異步NSURLConnection調用
- 18. 異步調用CollectionView.MoveCurrentToFirst?
- 19. webservice異步調用
- 20. 異步調用dll
- 21. 與異步調用
- 22. Django異步調用
- 23. 異步cuBLAS調用
- 24. NEST異步調用
- 25. Mongodb異步調用?
- 26. 異步調用nodeBlockForRowAtIndexPath
- 27. 異步調用webservice
- 28. AndroidTestCase - 異步調用
- 29. Alamofire異步調用
- 30. ajaxForm異步調用