-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix IReferenceNullDelete with hierarchy #201
base: develop
Are you sure you want to change the base?
Conversation
/// Конструктор. | ||
/// </summary> | ||
public IReferencesNullDeleteTests() | ||
: base("IRefNullDel") |
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.
Имя будет длинноватое. Надо не более 5 символов.
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.Reflection.Assembly.Load("NewPlatform.Flexberry.ORM.Tests.Objects"), | ||
}; | ||
|
||
ICSSoft.STORMNET.Business.OrmConfigurator.SetAssembliesForIReferencesNullDeleteSearch(assemblies); |
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.
Мне кажется, в интеграционных тестах это наиболее подходящая сущность.
Есть ещё базовый класс для интеграционных тестов, но там такая инициализация вероятно будет не к месту.
@@ -29,6 +29,12 @@ public XUnitTestRunnerInitializer(IMessageSink messageSink) | |||
string outputConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath; | |||
File.Copy(configFile, outputConfigFile, true); | |||
#endif | |||
var assemblies = new[] | |||
{ | |||
System.Reflection.Assembly.Load("NewPlatform.Flexberry.ORM.Tests.Objects"), |
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.
Хорошо. Делала по аналогии, как у нас в ODataService.
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.
Поправлено.
/// <returns>Набор объектов, для которых переданный является мастером.</returns> | ||
public static List<ReferencePropertyInfo> GetReferencedDataObjectsInfo(DataObject masterObject) | ||
public static List<ReferencePropertyInfo> GetReferencedDataObjectsInfo( |
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.
Раз это необязательный вызов, а лишь добавление доп. сборок, предлагаю переименовать на SetupAdditionalAssemblies.
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.
Поправлено.
/// <summary> | ||
/// Класс с настройками, используемыми в ORM. | ||
/// </summary> | ||
public static class OrmConfigurator |
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.
Предлагаю эту прослойку не вводить. Есть же уже InterfaceBusinesServer
со статическими методами.
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.
Ок.
…esNullDelete with self-reference
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.
Ещё бы проверить как скажется это изменение на производительности сервиса данных. Можно погонять тесты производительности, которые запускаются вручную.
@@ -4508,7 +4508,13 @@ private void AddDependencies(Type to, Type @from, Dictionary<Type, List<Type>> d | |||
/// <param name="currentType">Текущий обрабатываемый тип.</param> | |||
/// <param name="dependencies">Дополняемые зависимости.</param> | |||
/// <param name="extraUpdateList">Дополнительные объекты на обновление.</param> | |||
private void GetDependencies(DataObject currentObject, Type currentType, Dictionary<Type, List<Type>> dependencies, List<DataObject> extraUpdateList) | |||
/// <param name="selfReferences">Структура для хранения информации об иерархических мастеровых ссылках объекта самогона себя.</param> |
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.
самогона?
…exberry.ORM into fix-200-i-ref-null-delete
SonarCloud Quality Gate failed. |
public static List<ReferencePropertyInfo> GetReferencedDataObjectsInfo( | ||
DataObject masterObject, IEnumerable<Assembly> searchAssemblies = null) | ||
{ | ||
var realMasterObjectType = masterObject.GetType(); |
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.
var заменить на тип
return cache[realMasterObjectType]; | ||
} | ||
|
||
var referencePropertyInfos = new List<ReferencePropertyInfo>(); |
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.
и тут
@@ -187,7 +249,7 @@ public DataObject[] OnUpdateIReferencesCascadeDelete(IReferencesCascadeDelete Up | |||
} | |||
|
|||
List<ReferencePropertyInfo> referencePropertyInfos; | |||
var referenceObjectList = GetReferencedDataObjects(updatedDataObject, out referencePropertyInfos); | |||
var referenceObjectList = GetReferencedDataObjects(updatedDataObject, out referencePropertyInfos, AssembliesForIReferencesCascadeDeleteSearch); |
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.
и тут
@@ -216,7 +278,8 @@ public DataObject[] OnUpdateIReferencesNullDelete(IReferencesNullDelete UpdatedO | |||
} | |||
|
|||
List<ReferencePropertyInfo> referencePropertyInfos; | |||
var referenceObjectList = GetReferencedDataObjects(updatedDataObject, out referencePropertyInfos); | |||
var referenceObjectList = GetReferencedDataObjects( |
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.
и тут
@@ -4887,8 +4925,9 @@ private void GetOrderFromDependenciesHelper(Type currentType, Dictionary<Type, L | |||
var alteredLastList = new Dictionary<DataObject, Collections.CaseSensivityStringDictionary>(); | |||
var updateList = new Dictionary<DataObject, UpdaterObject>(); | |||
|
|||
List<DataObject> extraUpdateList = new List<DataObject>(); | |||
Dictionary<Type, List<Type>> dependencies = new Dictionary<Type, List<Type>>(); | |||
var extraUpdateList = new List<DataObject>(); |
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.
и тут
/* Ещё возможна редкая ситуация, когда у объекта есть ссылка на самого себя. Один объект удаляется, а ссылающийся на него обнуляет ссылку. | ||
В этом случае "стандартный" механизм, что над таблицей операции выполняются в порядке "Delete, Insert, Update" не подходит, | ||
потому что сначала нужен "Update" с занулением ссылки, а потом "Delete" с удалением сущности.*/ | ||
var alteredFirstSpecialList = new Dictionary<DataObject, Collections.CaseSensivityStringDictionary>(); |
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.
и нижу все var
No description provided.