-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add asyncronous DataService interface. #212
Add asyncronous DataService interface. #212
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поля, как мне кажется не должны быть в интерфейсе, только методы, а поля это уже к реализации.
Резюмирую все текущие замечания:
|
f0b0368
to
83ed095
Compare
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
ICSSoft.STORMNET.Business/SQLDataService/DbTransactionWrapperAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/DbTransactionWrapperAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/DbTransactionWrapperAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/DbTransactionWrapperAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.UpdateObjectsAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.UpdateObjectsAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.UpdateObjectsAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.UpdateObjectsAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/DbTransactionWrapperAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/DbTransactionWrapperAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/DbTransactionWrapperAsync.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
ICSSoft.STORMNET.Business/SQLDataService/SQLDataService.Async.cs
Outdated
Show resolved
Hide resolved
Добавил класс QueryRunner, чтобы сделать запуск запросов более понятным. |
using ICSSoft.Services; | ||
using ICSSoft.STORMNET.Business.Audit; | ||
using ICSSoft.STORMNET.FunctionalLanguage; | ||
using ICSSoft.STORMNET.FunctionalLanguage.SQLWhere; | ||
using ICSSoft.STORMNET.Security; | ||
using ICSSoft.STORMNET.Windows.Forms; | ||
|
||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep System
usings first
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пытался поставить System в начало -> получаю SA1210
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ок, поправил настройку stylecop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reordered
@@ -0,0 +1,205 @@ | |||
namespace NewPlatform.Flexberry.ORM.IntegratedTests | |||
{ | |||
using ICSSoft.STORMNET; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort usings, and put System first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reordered
|
||
for (int i = 0; i < tableOperations.Count; i++) | ||
{ | ||
this.tableOperations.Add( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Предлагаю приватные поля именовать в _camelCase, чтобы не приходилось в коде обращать внимание есть или нет this перед полем. Мне при первом прочтении показалось что этот цикл не выполнится ни разу из-за того, что буквально перед ним в очень похожую переменную новый пустой словарь присваивается
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переименовал приватные поля в _camelCase
|
||
Exception ex = null; | ||
|
||
while (queries.Count > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вроде список внутри цикла никак не пополняется. При этом RemoveAt имеет сложность O(n). Предлагаю заменить на foreach, и цикл будет лучше читаться и сложность на порядок уменьшится (хотя тут вряд ли именно сложность алгоритма на что-то влияет конечно)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
|
||
Exception ex = null; | ||
|
||
while (queries.Count > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
} | ||
|
||
/// <inheritdoc cref="IAsyncDataService.LoadObjectAsync(DataObject, View, bool, bool, DataObjectCache)" /> | ||
public virtual async Task LoadObjectAsync(DataObject dataObject, View dataObjectView = null, bool clearDataObject = true, bool checkExistingObject = true, DataObjectCache dataObjectCache = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Метод публичный, не хватает вызова RunChangeCustomizationString по-моему
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добавил
try | ||
{ | ||
Type dataObjectType = dataObject.GetType(); | ||
RunChangeCustomizationString(new Type[] { dataObjectType }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А вот тут вопрос, если подключение уже существующее передано, мы ведь не можем у него сменить строку подключения. Мне кажется тут вызов этого метода ни к чему не приведет как будто бы
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перенёс вызов смены строки подключения перед созданием подключения.
dataObjectCache.StartCaching(false); | ||
try | ||
{ | ||
RunChangeCustomizationString(customizationStruct.LoadingTypes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут тоже если подключение уже существующее передано смена строки подключения на него уже не повлияет вроде бы
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Верно. Перенёс вызов перед созданием подключения.
/// <param name="query">Запрос для вычитки.</param> | ||
/// <param name="loadingBufferSize">Ограничение на количество строк, которые будут загружены.</param> | ||
/// <returns>Асинхронная операция (возвращает результат вычитки).</returns> | ||
public virtual async Task<object[][]> ReadAsync(string query, int loadingBufferSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А это точно публичный должен быть метод, а не protected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Согласен, лучше этот метод сделать protected. ReadAsync врят ли будет кем-то использоваться. Странно, что оригинальный метод (ReadFirst/ReadNext) - публичный.
/// <param name="loadingBufferSize">Количество строк, которые нужно загрузить в рамках текущей вычитки (используется для повторной дочитки).</param> | ||
/// <param name="dbTransactionWrapperAsync">Содержит соединение и транзакцию, в рамках которых нужно выполнить запрос (если соединение закрыто - оно откроется).</param> | ||
/// <returns>Асинхронная операция (возвращает результат вычитки).</returns> | ||
public virtual async Task<object[][]> ReadByExtConnAsync(string query, int loadingBufferSize, DbTransactionWrapperAsync dbTransactionWrapperAsync) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично насчет protected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
Discussion: #205