Skip to content
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

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

Anisimova2020
Copy link
Contributor

No description provided.

/// Конструктор.
/// </summary>
public IReferencesNullDeleteTests()
: base("IRefNullDel")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Имя будет длинноватое. Надо не более 5 символов.

Copy link
Contributor Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Давай лучше это где-то в конструкторе интеграционных тестов сделаем?

Copy link
Contributor Author

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"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше взять какой-нибудь тип из объектов и взять у него сборку. Через строку - не вариант.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хорошо. Делала по аналогии, как у нас в ODataService.

Copy link
Contributor Author

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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Раз это необязательный вызов, а лишь добавление доп. сборок, предлагаю переименовать на SetupAdditionalAssemblies.

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предлагаю эту прослойку не вводить. Есть же уже InterfaceBusinesServer со статическими методами.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ок.

@Anisimova2020 Anisimova2020 marked this pull request as ready for review October 13, 2021 13:57
Copy link
Member

@bratchikov bratchikov left a 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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

самогона?

@bratchikov bratchikov linked an issue Oct 20, 2021 that may be closed by this pull request
@bratchikov bratchikov changed the title Added simple test for IReferenceNullDelete. Fix IReferenceNullDelete with hierarchy Oct 20, 2021
@bratchikov bratchikov added the bug label Oct 20, 2021
@sonarcloud
Copy link

sonarcloud bot commented Dec 6, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 21 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

public static List<ReferencePropertyInfo> GetReferencedDataObjectsInfo(
DataObject masterObject, IEnumerable<Assembly> searchAssemblies = null)
{
var realMasterObjectType = masterObject.GetType();
Copy link
Contributor

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>();
Copy link
Contributor

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);
Copy link
Contributor

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(
Copy link
Contributor

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>();
Copy link
Contributor

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>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и тут

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и нижу все var

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Реализовать тесты для IReferencesNullDelete
4 participants