From ff05085e2e2bf9511d8ff9e088c75da79bfb00ef Mon Sep 17 00:00:00 2001 From: dpse Date: Mon, 6 Jul 2020 23:09:00 +0200 Subject: [PATCH] Add ConfigureAwait(false) to all awaits in order to avoid capturing context and causing potential deadlocks. Fixes #94. --- .../Connectors/AbsenceTransactionConnector.cs | 10 +++--- .../Connectors/AccountChartConnector.cs | 2 +- .../Connectors/AccountConnector.cs | 10 +++--- .../Connectors/ArchiveConnector.cs | 30 ++++++++--------- .../Connectors/ArticleConnector.cs | 10 +++--- .../ArticleFileConnectionConnector.cs | 8 ++--- .../Connectors/AssetConnector.cs | 10 +++--- .../AssetFileConnectionConnector.cs | 8 ++--- .../Connectors/AssetTypesConnector.cs | 10 +++--- .../AttendanceTransactionsConnector.cs | 10 +++--- .../Connectors/CompanyInformationConnector.cs | 2 +- .../Connectors/CompanySettingsConnector.cs | 2 +- .../Connectors/ContractAccrualConnector.cs | 10 +++--- .../Connectors/ContractConnector.cs | 8 ++--- .../Connectors/ContractTemplateConnector.cs | 8 ++--- .../Connectors/CostCenterConnector.cs | 10 +++--- .../Connectors/CurrencyConnector.cs | 10 +++--- .../Connectors/CustomerConnector.cs | 10 +++--- .../Connectors/EmployeeConnector.cs | 8 ++--- .../Connectors/ExpenseConnector.cs | 6 ++-- .../Connectors/FinancialYearConnector.cs | 6 ++-- .../Connectors/InvoiceAccrualConnector.cs | 10 +++--- .../Connectors/InvoiceConnector.cs | 8 ++--- .../InvoiceFileConnectionConnector.cs | 8 ++--- .../Connectors/InvoicePaymentConnector.cs | 10 +++--- .../Connectors/LabelConnector.cs | 8 ++--- .../Connectors/LockedPeriodConnector.cs | 2 +- .../Connectors/ModeOfPaymentConnector.cs | 10 +++--- .../Connectors/OfferConnector.cs | 8 ++--- .../Connectors/OrderConnector.cs | 8 ++--- .../Connectors/PredefinedAccountsConnector.cs | 6 ++-- .../PredefinedVoucherSeriesConnector.cs | 6 ++-- .../Connectors/PriceConnector.cs | 10 +++--- .../Connectors/PriceListConnector.cs | 8 ++--- .../Connectors/PrintTemplateConnector.cs | 2 +- .../Connectors/ProjectConnector.cs | 10 +++--- FortnoxAPILibrary/Connectors/SIEConnector.cs | 2 +- .../Connectors/SalaryTransactionConnector.cs | 10 +++--- .../Connectors/ScheduleTimesConnector.cs | 8 ++--- .../Connectors/SupplierConnector.cs | 10 +++--- .../SupplierInvoiceAccrualConnector.cs | 10 +++--- .../Connectors/SupplierInvoiceConnector.cs | 8 ++--- ...erInvoiceExternalURLConnectionConnector.cs | 10 +++--- .../SupplierInvoiceFileConnectionConnector.cs | 8 ++--- .../SupplierInvoicePaymentConnector.cs | 10 +++--- .../Connectors/TaxReductionConnector.cs | 10 +++--- .../Connectors/TermsOfDeliveryConnector.cs | 10 +++--- .../Connectors/TermsOfPaymentConnector.cs | 10 +++--- .../TrustedEmailDomainsConnector.cs | 8 ++--- .../TrustedEmailSendersConnector.cs | 6 ++-- FortnoxAPILibrary/Connectors/UnitConnector.cs | 10 +++--- .../Connectors/VoucherConnector.cs | 6 ++-- .../VoucherFileConnectionConnector.cs | 8 ++--- .../Connectors/VoucherSeriesConnector.cs | 8 ++--- .../Connectors/WayOfDeliveryConnector.cs | 10 +++--- FortnoxAPILibrary/EntityConnector.cs | 16 +++++----- FortnoxAPILibrary/Extensions.cs | 16 +++++----- FortnoxAPILibrary/UrlRequestBase.cs | 32 +++++++++---------- 58 files changed, 264 insertions(+), 264 deletions(-) diff --git a/FortnoxAPILibrary/Connectors/AbsenceTransactionConnector.cs b/FortnoxAPILibrary/Connectors/AbsenceTransactionConnector.cs index b996b5c5..6a4bbf64 100644 --- a/FortnoxAPILibrary/Connectors/AbsenceTransactionConnector.cs +++ b/FortnoxAPILibrary/Connectors/AbsenceTransactionConnector.cs @@ -83,23 +83,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string employeeId, DateTime? date, AbsenceCauseCode? code) { - await BaseDelete(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()); + await BaseDelete(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()).ConfigureAwait(false); } public async Task CreateAsync(AbsenceTransaction absenceTransaction) { - return await BaseCreate(absenceTransaction); + return await BaseCreate(absenceTransaction).ConfigureAwait(false); } public async Task UpdateAsync(AbsenceTransaction absenceTransaction) { - return await BaseUpdate(absenceTransaction, absenceTransaction.EmployeeId, absenceTransaction.Date?.ToString(APIConstants.DateFormat), absenceTransaction.CauseCode?.GetStringValue()); + return await BaseUpdate(absenceTransaction, absenceTransaction.EmployeeId, absenceTransaction.Date?.ToString(APIConstants.DateFormat), absenceTransaction.CauseCode?.GetStringValue()).ConfigureAwait(false); } public async Task GetAsync(string employeeId, DateTime? date, AbsenceCauseCode? code) { - return await BaseGet(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()); + return await BaseGet(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/AccountChartConnector.cs b/FortnoxAPILibrary/Connectors/AccountChartConnector.cs index ec7ade6f..acbdfa00 100644 --- a/FortnoxAPILibrary/Connectors/AccountChartConnector.cs +++ b/FortnoxAPILibrary/Connectors/AccountChartConnector.cs @@ -32,7 +32,7 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/AccountConnector.cs b/FortnoxAPILibrary/Connectors/AccountConnector.cs index 8c7a756e..07a82ef1 100644 --- a/FortnoxAPILibrary/Connectors/AccountConnector.cs +++ b/FortnoxAPILibrary/Connectors/AccountConnector.cs @@ -77,23 +77,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(int? id) { - await BaseDelete(id.ToString()); + await BaseDelete(id.ToString()).ConfigureAwait(false); } public async Task CreateAsync(Account account) { - return await BaseCreate(account); + return await BaseCreate(account).ConfigureAwait(false); } public async Task UpdateAsync(Account account) { - return await BaseUpdate(account, account.Number.ToString()); + return await BaseUpdate(account, account.Number.ToString()).ConfigureAwait(false); } public async Task GetAsync(int? id) { - return await BaseGet(id.ToString()); + return await BaseGet(id.ToString()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/ArchiveConnector.cs b/FortnoxAPILibrary/Connectors/ArchiveConnector.cs index c829cbda..b7e3c9dc 100644 --- a/FortnoxAPILibrary/Connectors/ArchiveConnector.cs +++ b/FortnoxAPILibrary/Connectors/ArchiveConnector.cs @@ -124,13 +124,13 @@ public void DeleteFolder(string pathOrId) public async Task DownloadFileAsync(string id) { - return await BaseDownload(null, id); + return await BaseDownload(null, id).ConfigureAwait(false); } public async Task DownloadFileAsync(string id, string localPath) { - var data = await DownloadFileAsync(id); - return await data.ToFile(localPath); + var data = await DownloadFileAsync(id).ConfigureAwait(false); + return await data.ToFile(localPath).ConfigureAwait(false); } public async Task UploadFileAsync(string name, byte[] data, string folderPathOrId = null) @@ -154,23 +154,23 @@ public async Task UploadFileAsync(string name, byte[] data, string else urlParams.Add("path", folderPathOrId); - return await BaseUpload(name, data, urlParams); + return await BaseUpload(name, data, urlParams).ConfigureAwait(false); } public async Task UploadFileAsync(string name, Stream stream, string folderPathOrId = null) { - return await UploadFileAsync(name, await stream.ToBytes(), folderPathOrId); + return await UploadFileAsync(name, await stream.ToBytes(), folderPathOrId).ConfigureAwait(false); } public async Task UploadFileAsync(string localPath, string folderPathOrId = null) { var fileInfo = new FileInfo(localPath); - return await UploadFileAsync(fileInfo.Name, fileInfo.ToBytes().Result, folderPathOrId); + return await UploadFileAsync(fileInfo.Name, fileInfo.ToBytes().Result, folderPathOrId).ConfigureAwait(false); } public async Task DeleteFileAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task GetFolderAsync(string pathOrId = null) @@ -179,18 +179,18 @@ public async Task GetFolderAsync(string pathOrId = null) pathOrId = "root"; if (IsArchiveId(pathOrId) || IsPredefinedFolder(pathOrId)) - return await BaseGet(pathOrId); + return await BaseGet(pathOrId).ConfigureAwait(false); else { ParametersInjection = new Dictionary(); ParametersInjection.Add("path", pathOrId); - return await BaseGet(); + return await BaseGet().ConfigureAwait(false); } } public async Task GetRootAsync() { - return await GetFolderAsync(); + return await GetFolderAsync().ConfigureAwait(false); } public async Task CreateFolderAsync(string folderName, string path = null) @@ -200,17 +200,17 @@ public async Task CreateFolderAsync(string folderName, string pat if (path != null) ParametersInjection = new Dictionary { { "path", path } }; - return await BaseCreate(folder); + return await BaseCreate(folder).ConfigureAwait(false); } public async Task DeleteFolderAsync(string pathOrId) { if (IsArchiveId(pathOrId)) - await BaseDelete(pathOrId); + await BaseDelete(pathOrId).ConfigureAwait(false); else { ParametersInjection = new Dictionary { { "path", pathOrId } }; - await BaseDelete(); + await BaseDelete().ConfigureAwait(false); } } @@ -226,7 +226,7 @@ private async Task BaseUpload(string name, byte[] data, Dictionary< Indices = indices }; - return await UploadFile(data, name); + return await UploadFile(data, name).ConfigureAwait(false); } private async Task BaseDownload(Dictionary parameters, params string[] indices) @@ -239,7 +239,7 @@ private async Task BaseDownload(Dictionary parameters, p Indices = indices }; - return await DownloadFile(); + return await DownloadFile().ConfigureAwait(false); } private static bool IsArchiveId(string str) diff --git a/FortnoxAPILibrary/Connectors/ArticleConnector.cs b/FortnoxAPILibrary/Connectors/ArticleConnector.cs index 69fa1080..f361016d 100644 --- a/FortnoxAPILibrary/Connectors/ArticleConnector.cs +++ b/FortnoxAPILibrary/Connectors/ArticleConnector.cs @@ -106,23 +106,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task
CreateAsync(Article article) { - return await BaseCreate(article); + return await BaseCreate(article).ConfigureAwait(false); } public async Task
UpdateAsync(Article article) { - return await BaseUpdate(article, article.ArticleNumber); + return await BaseUpdate(article, article.ArticleNumber).ConfigureAwait(false); } public async Task
GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/ArticleFileConnectionConnector.cs b/FortnoxAPILibrary/Connectors/ArticleFileConnectionConnector.cs index 6d08efbd..6e8d0109 100644 --- a/FortnoxAPILibrary/Connectors/ArticleFileConnectionConnector.cs +++ b/FortnoxAPILibrary/Connectors/ArticleFileConnectionConnector.cs @@ -68,19 +68,19 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task CreateAsync(ArticleFileConnection articleFileConnection) { - return await BaseCreate(articleFileConnection); + return await BaseCreate(articleFileConnection).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/AssetConnector.cs b/FortnoxAPILibrary/Connectors/AssetConnector.cs index 0a44a34c..f394bcbf 100644 --- a/FortnoxAPILibrary/Connectors/AssetConnector.cs +++ b/FortnoxAPILibrary/Connectors/AssetConnector.cs @@ -84,17 +84,17 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task CreateAsync(Asset asset) { FixResponseContent = (json) => new Regex("Assets").Replace(json, "Asset", 1); - var result = await BaseCreate(asset); + var result = await BaseCreate(asset).ConfigureAwait(false); FixResponseContent = null; return result; @@ -105,7 +105,7 @@ public async Task UpdateAsync(Asset asset) asset.Id = null; FixResponseContent = (json) => new Regex("Assets").Replace(json, "Asset", 1); - var result = await BaseUpdate(asset, id); + var result = await BaseUpdate(asset, id).ConfigureAwait(false); FixResponseContent = null; asset.Id = id; @@ -116,7 +116,7 @@ public async Task GetAsync(string id) { FixResponseContent = (json) => new Regex("Assets").Replace(json, "Asset", 1); - var result = await BaseGet(id); + var result = await BaseGet(id).ConfigureAwait(false); FixResponseContent = null; return result; diff --git a/FortnoxAPILibrary/Connectors/AssetFileConnectionConnector.cs b/FortnoxAPILibrary/Connectors/AssetFileConnectionConnector.cs index c7252987..c1312d48 100644 --- a/FortnoxAPILibrary/Connectors/AssetFileConnectionConnector.cs +++ b/FortnoxAPILibrary/Connectors/AssetFileConnectionConnector.cs @@ -67,19 +67,19 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task CreateAsync(AssetFileConnection assetFileConnection) { - return await BaseCreate(assetFileConnection); + return await BaseCreate(assetFileConnection).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/AssetTypesConnector.cs b/FortnoxAPILibrary/Connectors/AssetTypesConnector.cs index a20fee9f..341a9357 100644 --- a/FortnoxAPILibrary/Connectors/AssetTypesConnector.cs +++ b/FortnoxAPILibrary/Connectors/AssetTypesConnector.cs @@ -84,20 +84,20 @@ public async Task> FindAsync() return fixedJson; }; - var result = await BaseFind(); + var result = await BaseFind().ConfigureAwait(false); FixResponseContent = null; return result; } public async Task DeleteAsync(int? id) { - await BaseDelete(id.ToString()); + await BaseDelete(id.ToString()).ConfigureAwait(false); } public async Task CreateAsync(AssetType assetType) { FixResponseContent = (json) => new Regex("Type").Replace(json, "AssetType", 1); - var result = await BaseCreate(assetType); + var result = await BaseCreate(assetType).ConfigureAwait(false); FixResponseContent = null; return result; @@ -106,7 +106,7 @@ public async Task UpdateAsync(AssetType assetTypes) { FixResponseContent = (json) => new Regex("Type").Replace(json, "AssetType", 1); - var result = await BaseUpdate(assetTypes, assetTypes.Id.ToString()); + var result = await BaseUpdate(assetTypes, assetTypes.Id.ToString()).ConfigureAwait(false); FixResponseContent = null; return result; @@ -115,7 +115,7 @@ public async Task GetAsync(int? id) { FixResponseContent = (json) => new Regex("Type").Replace(json, "AssetType", 1); - var result = await BaseGet(id.ToString()); + var result = await BaseGet(id.ToString()).ConfigureAwait(false); FixResponseContent = null; return result; diff --git a/FortnoxAPILibrary/Connectors/AttendanceTransactionsConnector.cs b/FortnoxAPILibrary/Connectors/AttendanceTransactionsConnector.cs index 9a559ff3..a740a1fa 100644 --- a/FortnoxAPILibrary/Connectors/AttendanceTransactionsConnector.cs +++ b/FortnoxAPILibrary/Connectors/AttendanceTransactionsConnector.cs @@ -82,23 +82,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string employeeId, DateTime? date, AttendanceCauseCode? code) { - await BaseDelete(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()); + await BaseDelete(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()).ConfigureAwait(false); } public async Task CreateAsync(AttendanceTransaction attendanceTransaction) { - return await BaseCreate(attendanceTransaction); + return await BaseCreate(attendanceTransaction).ConfigureAwait(false); } public async Task UpdateAsync(AttendanceTransaction attendanceTransaction) { - return await BaseUpdate(attendanceTransaction, attendanceTransaction.EmployeeId, attendanceTransaction.Date?.ToString(APIConstants.DateFormat), attendanceTransaction.CauseCode?.GetStringValue()); + return await BaseUpdate(attendanceTransaction, attendanceTransaction.EmployeeId, attendanceTransaction.Date?.ToString(APIConstants.DateFormat), attendanceTransaction.CauseCode?.GetStringValue()).ConfigureAwait(false); } public async Task GetAsync(string employeeId, DateTime? date, AttendanceCauseCode? code) { - return await BaseGet(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()); + return await BaseGet(employeeId, date?.ToString(APIConstants.DateFormat), code?.GetStringValue()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/CompanyInformationConnector.cs b/FortnoxAPILibrary/Connectors/CompanyInformationConnector.cs index 2f028ad6..d14fb78d 100644 --- a/FortnoxAPILibrary/Connectors/CompanyInformationConnector.cs +++ b/FortnoxAPILibrary/Connectors/CompanyInformationConnector.cs @@ -26,7 +26,7 @@ public CompanyInformation Get() public async Task GetAsync() { - return (await BaseFind())?.Entity; + return (await BaseFind().ConfigureAwait(false))?.Entity; } } } diff --git a/FortnoxAPILibrary/Connectors/CompanySettingsConnector.cs b/FortnoxAPILibrary/Connectors/CompanySettingsConnector.cs index e884bc49..e090c848 100644 --- a/FortnoxAPILibrary/Connectors/CompanySettingsConnector.cs +++ b/FortnoxAPILibrary/Connectors/CompanySettingsConnector.cs @@ -26,7 +26,7 @@ public CompanySettings Get() public async Task GetAsync() { - return (await BaseFind())?.Entity; + return (await BaseFind().ConfigureAwait(false))?.Entity; } } } diff --git a/FortnoxAPILibrary/Connectors/ContractAccrualConnector.cs b/FortnoxAPILibrary/Connectors/ContractAccrualConnector.cs index 5522c395..466e3c43 100644 --- a/FortnoxAPILibrary/Connectors/ContractAccrualConnector.cs +++ b/FortnoxAPILibrary/Connectors/ContractAccrualConnector.cs @@ -71,23 +71,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(int? id) { - await BaseDelete(id.ToString()); + await BaseDelete(id.ToString()).ConfigureAwait(false); } public async Task CreateAsync(ContractAccrual contractAccrual) { - return await BaseCreate(contractAccrual); + return await BaseCreate(contractAccrual).ConfigureAwait(false); } public async Task UpdateAsync(ContractAccrual contractAccrual) { - return await BaseUpdate(contractAccrual, contractAccrual.DocumentNumber.ToString()); + return await BaseUpdate(contractAccrual, contractAccrual.DocumentNumber.ToString()).ConfigureAwait(false); } public async Task GetAsync(int? id) { - return await BaseGet(id.ToString()); + return await BaseGet(id.ToString()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/ContractConnector.cs b/FortnoxAPILibrary/Connectors/ContractConnector.cs index 691eaded..6199e455 100644 --- a/FortnoxAPILibrary/Connectors/ContractConnector.cs +++ b/FortnoxAPILibrary/Connectors/ContractConnector.cs @@ -129,19 +129,19 @@ public Contract IncreaseInvoiceCount(int? id) public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task CreateAsync(Contract contract) { - return await BaseCreate(contract); + return await BaseCreate(contract).ConfigureAwait(false); } public async Task UpdateAsync(Contract contract) { - return await BaseUpdate(contract, contract.DocumentNumber.ToString()); + return await BaseUpdate(contract, contract.DocumentNumber.ToString()).ConfigureAwait(false); } public async Task GetAsync(int? id) { - return await BaseGet(id.ToString()); + return await BaseGet(id.ToString()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/ContractTemplateConnector.cs b/FortnoxAPILibrary/Connectors/ContractTemplateConnector.cs index f3ad9ad3..6cd9b985 100644 --- a/FortnoxAPILibrary/Connectors/ContractTemplateConnector.cs +++ b/FortnoxAPILibrary/Connectors/ContractTemplateConnector.cs @@ -62,19 +62,19 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task CreateAsync(ContractTemplate contractTemplate) { - return await BaseCreate(contractTemplate); + return await BaseCreate(contractTemplate).ConfigureAwait(false); } public async Task UpdateAsync(ContractTemplate contractTemplate) { - return await BaseUpdate(contractTemplate, contractTemplate.TemplateNumber); + return await BaseUpdate(contractTemplate, contractTemplate.TemplateNumber).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/CostCenterConnector.cs b/FortnoxAPILibrary/Connectors/CostCenterConnector.cs index 90ea4c79..bdf48c72 100644 --- a/FortnoxAPILibrary/Connectors/CostCenterConnector.cs +++ b/FortnoxAPILibrary/Connectors/CostCenterConnector.cs @@ -71,23 +71,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task CreateAsync(CostCenter costCenter) { - return await BaseCreate(costCenter); + return await BaseCreate(costCenter).ConfigureAwait(false); } public async Task UpdateAsync(CostCenter costCenter) { - return await BaseUpdate(costCenter, costCenter.Code); + return await BaseUpdate(costCenter, costCenter.Code).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/CurrencyConnector.cs b/FortnoxAPILibrary/Connectors/CurrencyConnector.cs index 91685b79..1e2aff2d 100644 --- a/FortnoxAPILibrary/Connectors/CurrencyConnector.cs +++ b/FortnoxAPILibrary/Connectors/CurrencyConnector.cs @@ -71,23 +71,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task CreateAsync(Currency currency) { - return await BaseCreate(currency); + return await BaseCreate(currency).ConfigureAwait(false); } public async Task UpdateAsync(Currency currency) { - return await BaseUpdate(currency, currency.Code); + return await BaseUpdate(currency, currency.Code).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/CustomerConnector.cs b/FortnoxAPILibrary/Connectors/CustomerConnector.cs index eebe4d63..7a9aaa6c 100644 --- a/FortnoxAPILibrary/Connectors/CustomerConnector.cs +++ b/FortnoxAPILibrary/Connectors/CustomerConnector.cs @@ -125,23 +125,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task CreateAsync(Customer customer) { - return await BaseCreate(customer); + return await BaseCreate(customer).ConfigureAwait(false); } public async Task UpdateAsync(Customer customer) { - return await BaseUpdate(customer, customer.CustomerNumber); + return await BaseUpdate(customer, customer.CustomerNumber).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/EmployeeConnector.cs b/FortnoxAPILibrary/Connectors/EmployeeConnector.cs index c26e3793..1751de66 100644 --- a/FortnoxAPILibrary/Connectors/EmployeeConnector.cs +++ b/FortnoxAPILibrary/Connectors/EmployeeConnector.cs @@ -62,19 +62,19 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task CreateAsync(Employee employee) { - return await BaseCreate(employee); + return await BaseCreate(employee).ConfigureAwait(false); } public async Task UpdateAsync(Employee employee) { - return await BaseUpdate(employee, employee.EmployeeId); + return await BaseUpdate(employee, employee.EmployeeId).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/ExpenseConnector.cs b/FortnoxAPILibrary/Connectors/ExpenseConnector.cs index d1ccefc8..f3ce0aa6 100644 --- a/FortnoxAPILibrary/Connectors/ExpenseConnector.cs +++ b/FortnoxAPILibrary/Connectors/ExpenseConnector.cs @@ -52,15 +52,15 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task CreateAsync(Expense expense) { - return await BaseCreate(expense); + return await BaseCreate(expense).ConfigureAwait(false); } public async Task GetAsync(string id) { - return await BaseGet(id); + return await BaseGet(id).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/FinancialYearConnector.cs b/FortnoxAPILibrary/Connectors/FinancialYearConnector.cs index 9d9f6650..883819d6 100644 --- a/FortnoxAPILibrary/Connectors/FinancialYearConnector.cs +++ b/FortnoxAPILibrary/Connectors/FinancialYearConnector.cs @@ -57,15 +57,15 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task CreateAsync(FinancialYear financialYear) { - return await BaseCreate(financialYear); + return await BaseCreate(financialYear).ConfigureAwait(false); } public async Task GetAsync(int? id) { - return await BaseGet(id.ToString()); + return await BaseGet(id.ToString()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/InvoiceAccrualConnector.cs b/FortnoxAPILibrary/Connectors/InvoiceAccrualConnector.cs index 9bfa29c6..773aeeb4 100644 --- a/FortnoxAPILibrary/Connectors/InvoiceAccrualConnector.cs +++ b/FortnoxAPILibrary/Connectors/InvoiceAccrualConnector.cs @@ -72,23 +72,23 @@ public EntityCollection Find() public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(int? id) { - await BaseDelete(id.ToString()); + await BaseDelete(id.ToString()).ConfigureAwait(false); } public async Task CreateAsync(InvoiceAccrual invoiceAccrual) { - return await BaseCreate(invoiceAccrual); + return await BaseCreate(invoiceAccrual).ConfigureAwait(false); } public async Task UpdateAsync(InvoiceAccrual invoiceAccrual) { - return await BaseUpdate(invoiceAccrual, invoiceAccrual.InvoiceNumber.ToString()); + return await BaseUpdate(invoiceAccrual, invoiceAccrual.InvoiceNumber.ToString()).ConfigureAwait(false); } public async Task GetAsync(int? id) { - return await BaseGet(id.ToString()); + return await BaseGet(id.ToString()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/InvoiceConnector.cs b/FortnoxAPILibrary/Connectors/InvoiceConnector.cs index 919c4101..3d0e1db3 100644 --- a/FortnoxAPILibrary/Connectors/InvoiceConnector.cs +++ b/FortnoxAPILibrary/Connectors/InvoiceConnector.cs @@ -249,19 +249,19 @@ public byte[] Preview(int? id) public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task CreateAsync(Invoice invoice) { - return await BaseCreate(invoice); + return await BaseCreate(invoice).ConfigureAwait(false); } public async Task UpdateAsync(Invoice invoice) { - return await BaseUpdate(invoice, invoice.DocumentNumber.ToString()); + return await BaseUpdate(invoice, invoice.DocumentNumber.ToString()).ConfigureAwait(false); } public async Task GetAsync(int? id) { - return await BaseGet(id.ToString()); + return await BaseGet(id.ToString()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/InvoiceFileConnectionConnector.cs b/FortnoxAPILibrary/Connectors/InvoiceFileConnectionConnector.cs index 0cb48fe8..088645a1 100644 --- a/FortnoxAPILibrary/Connectors/InvoiceFileConnectionConnector.cs +++ b/FortnoxAPILibrary/Connectors/InvoiceFileConnectionConnector.cs @@ -63,7 +63,7 @@ public void Delete(string id) public async Task DeleteAsync(string id) { - await BaseDelete(id); + await BaseDelete(id).ConfigureAwait(false); } public async Task CreateAsync(InvoiceFileConnection invoiceFileConnection) { @@ -77,7 +77,7 @@ public async Task CreateAsync(InvoiceFileConnection invoi }; var entity = new List() { invoiceFileConnection }; - var result = await DoEntityRequest(entity); + var result = await DoEntityRequest(entity).ConfigureAwait(false); return result?.FirstOrDefault(); } @@ -97,7 +97,7 @@ public async Task UpdateAsync(InvoiceFileConnection invoi IncludeOnSend = invoiceFileConnection.IncludeOnSend }; - var result = await DoEntityRequest(limitedEntity); + var result = await DoEntityRequest(limitedEntity).ConfigureAwait(false); return result; } @@ -116,7 +116,7 @@ public async Task> GetConnectionsAsync(long? entityI ResponseType = RequestResponseType.JSON }; - var result = await DoEntityRequest>(); + var result = await DoEntityRequest>().ConfigureAwait(false); return result; } } diff --git a/FortnoxAPILibrary/Connectors/InvoicePaymentConnector.cs b/FortnoxAPILibrary/Connectors/InvoicePaymentConnector.cs index cc8d4e00..04574eb2 100644 --- a/FortnoxAPILibrary/Connectors/InvoicePaymentConnector.cs +++ b/FortnoxAPILibrary/Connectors/InvoicePaymentConnector.cs @@ -86,23 +86,23 @@ public void Bookkeep(int? id) public async Task> FindAsync() { - return await BaseFind(); + return await BaseFind().ConfigureAwait(false); } public async Task DeleteAsync(int? id) { - await BaseDelete(id.ToString()); + await BaseDelete(id.ToString()).ConfigureAwait(false); } public async Task CreateAsync(InvoicePayment invoicePayment) { - return await BaseCreate(invoicePayment); + return await BaseCreate(invoicePayment).ConfigureAwait(false); } public async Task UpdateAsync(InvoicePayment invoicePayment) { - return await BaseUpdate(invoicePayment, invoicePayment.Number.ToString()); + return await BaseUpdate(invoicePayment, invoicePayment.Number.ToString()).ConfigureAwait(false); } public async Task GetAsync(int? id) { - return await BaseGet(id.ToString()); + return await BaseGet(id.ToString()).ConfigureAwait(false); } } } diff --git a/FortnoxAPILibrary/Connectors/LabelConnector.cs b/FortnoxAPILibrary/Connectors/LabelConnector.cs index 570842c3..cc90c43c 100644 --- a/FortnoxAPILibrary/Connectors/LabelConnector.cs +++ b/FortnoxAPILibrary/Connectors/LabelConnector.cs @@ -62,19 +62,19 @@ public EntityCollection