-
Notifications
You must be signed in to change notification settings - Fork 66
Обновление документации по изменениям ORM 6.0.0 - 7.* #169
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
base: master
Are you sure you want to change the base?
Conversation
| * [Задать детейлы в представление](fa_prop-order-limit-editor.html), если их ещё там нет. | ||
| * Задать [свойство AutoAddUsedInLimitationProperties](fa_prop-order-limit-editor.html), чтобы представление формировалось динамически. | ||
| * Определить механизм формирования динамического представления для детейлов через интерфейс ICSSoft.STORMNET.Windows.Forms.IViewGenerator (расположен в сборке ExternalLangDef). Например, в версии после 14.01.2015 можно в конфиг добавить следующую строчку: | ||
| * Определить механизм формирования динамического представления для детейлов через интерфейс ICSSoft.STORMNET.Windows.Forms.IViewGenerator (расположен в сборке ICSSoft.STORMNET.Business.ExternalLangDef). Например, в версии после 14.01.2015 можно в конфиг добавить следующую строчку: |
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.
Вероятно фразу "в версии после 14.01.2015" уже можно удалить.
И также написать альтернативный вариант, как такое сделать с помощью кода.
| <container> | ||
| ... | ||
| <register type="ICSSoft.STORMNET.Windows.Forms.IViewGenerator, ExternalLangDef" mapTo="NewPlatform.Flexberry.Web.Page.LimitEditorViewGenerator, NewPlatform.Flexberry.Web.LimitEditor" /> | ||
| <register type="ICSSoft.STORMNET.Windows.Forms.IViewGenerator, ICSSoft.STORMNET.Business.ExternalLangDef" mapTo="NewPlatform.Flexberry.Web.Page.LimitEditorViewGenerator, NewPlatform.Flexberry.Web.LimitEditor" /> |
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.
Надо перепроверить, актуален ли вариант, указанный в "mapTo".
|
|
||
| * **ChangesToSqlBTMonitor.dll** - библиотека, содержащая классы для работы [сервиса записи SQL-скриптов изменения данных](fo_changes-sql-bt-monitor.html). | ||
| * **ExternalLangDef.dll** - библиотека, содержащая [расширение языка ограничений](fo_external-lang-def.html) для [задания ограничений](fo_limit-function.html) на зависимые объекты. | ||
| * **ChangesToSqlBTMonitor.dll** - библиотека, содержащая |
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.
Что-то не до конца поправлено? Эта библиотека ещё есть?
| ### Сервис данных | ||
|
|
||
| По умолчанию для выгрузки в Excel используется сервис данных `DataServiceProvider.DataService`. Если требуется задать другой, отдельный сервис данных для выгрузки в Excel, то это может быть сделано в `Web.config` путем регистрации сервиса под именем `ExcelExportDataService` в `Unity`. Пример конфигурации, чтобы для выгрузки в Excel использовался сервис данных `IcsharpSoft.STORMNET.Business.DRDataService`: | ||
| По умолчанию для выгрузки в Excel используется сервис данных `DataServiceProvider.DataService`. Если требуется задать другой, отдельный сервис данных для выгрузки в Excel, то это может быть сделано в `Web.config` путем регистрации сервиса под именем `ExcelExportDataService` в `Unity`. Пример конфигурации, чтобы для выгрузки в Excel использовался сервис данных `ICSSoft.STORMNET.Business.DRDataService`: |
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.
Нужно перепроверить, что "По умолчанию для выгрузки в Excel используется сервис данных DataServiceProvider.DataService." Вообще нужно отметить, что DataServiceProvider.DataService ныне obsolete.
Также сейчас для сервисов данных регистрация в Юнити выглядит иначе.
…xberry.github.io into feature-232917-update-docs
|
|
||
| ```csharp | ||
| IUnityContainer container = UnityFactory.CreateContainer(); | ||
| IUnityContainer container = UnityFactory.CreateContainer(); //UnityFactory is deprecated. Inject IUnityContainer (or IServiceProvider) instead. |
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.
Мне кажется, что само упоминание UnityFactory в этом месте нужно вырезать в коде. То есть в коде показать, как правильно, без factory, а в комментарии указать, что ранее использовалось UnityFactory, но ныне этот класс устарел.
| IDataService dataService = container.Resolve<IDataService>("DRDataService"); | ||
| dataService.CustomizationString = DataServiceProvider.DataService.CustomizationString; | ||
| ``` | ||
| dataService.CustomizationString = DataServiceProvider.DataService.CustomizationString; // DataServiceProvider is deprecated; inject IDataService instead |
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.
Аналогично: код меняем на то, что ныне правильно.
| <unity xmlns="http://schemas.microsoft.com/practices/2010/unity"> | ||
| <container> | ||
| <register name="DRDataService" type="ICSSoft.STORMNET.Business.IDataService, ICSSoft.STORMNET.Business" mapTo="ICSSoft.STORMNET.Business.DRDataService, ICSSoft.STORMNET.Business.DRDataService"> | ||
| <register name="DRDataService" type="ICSSoft.STORMNET.Business.IDataService, ICSSoft.STORMNET.Business" mapTo="ICSSoft.STORMNET.Business.DRDataService, ICSSoft.STORMNET.Business.MSSQLDataService"> |
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.
Сейчас сервисы данных иначе регистрируются
|
|
||
| ```csharp | ||
| IUnityContainer container = UnityFactory.CreateContainer(); | ||
| IUnityContainer container = UnityFactory.CreateContainer(); // UnityFactory устарел. Вместо него используйте внедрение зависимостей (инжектите IUnityContainer/IServiceProvider или напрямую нужные зависимости). |
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.
Код нужно написать по-новому.
| IUnityContainer container = UnityFactory.CreateContainer(); // UnityFactory устарел. Вместо него используйте внедрение зависимостей (инжектите IUnityContainer/IServiceProvider или напрямую нужные зависимости). | ||
| IDataService dataService = container.Resolve<IDataService>("DRDataService"); | ||
| dataService.CustomizationString = DataServiceProvider.DataService.CustomizationString; | ||
| dataService.CustomizationString = DataServiceProvider.DataService.CustomizationString; // DataServiceProvider устарел; вместо него используйте внедрение зависимостей. |
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 lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof(СтрокаЗаказа), СтрокаЗаказа.Views.СтрокаЗаказаE); | ||
| lcs.LimitFunction = FunctionBuilder.BuildEquals<СтрокаЗаказа>(x => x.Заказ, заказ); | ||
| var строкиЗаказа = DataServiceProvider.DataService.LoadObjects(lcs); | ||
| var строкиЗаказа = DataServiceProvider.DataService.LoadObjects(lcs); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Непонятно, почему у данного файла изменена только английская версия.
| ICSSoft.STORMNET.Business.LoadingCustomizationStruct lcs = ICSSoft.STORMNET.Business.LoadingCustomizationStruct.GetSimpleStruct(typeof(ТоварНаСкладе),"Tavernacle"); | ||
| lcs.LimitFunction = lf; | ||
| ICSSoft.STORMNET.DataObject[] objs = ICSSoft.STORMNET.Business.DataServiceProvider.DataService.LoadObjects(lcs); | ||
| ICSSoft.STORMNET.DataObject[] objs = ICSSoft.STORMNET.Business.DataServiceProvider.DataService.LoadObjects(lcs); // DataServiceProvider is deprecated; inject IDataService instead |
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.
Нужно переписать без использования DataServiceProvider.DataService.
| lcs.ColumnsSort = sortColumns.ToArray(); | ||
|
|
||
| DataObject[] objs = DataServiceProvider.DataService.LoadObjects(lcs); | ||
| DataObject[] objs = DataServiceProvider.DataService.LoadObjects(lcs); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Нужно переписать код на правильный вариант.
| ... | ||
|
|
||
| DataObject[] objs = DataServiceProvider.DataService.LoadObjects(lcs); | ||
| DataObject[] objs = DataServiceProvider.DataService.LoadObjects(lcs); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать код нужно
| ```csharp | ||
| ExternalLangDef externalLangDef = ExternalLangDef.LanguageDef; | ||
| ExternalLangDef externalLangDef = ExternalLangDef.LanguageDef; // Использование ExternalLangDef.LanguageDef является устаревшим. Вместо него используйте конструктор (new ExternalLangDef(dataService)). |
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.
Код нужно переписать.
|
|
||
| ``` csharp | ||
| var ds = (SQLDataService)DataServiceProvider.DataService; | ||
| var ds = (SQLDataService)DataServiceProvider.DataService; // DataServiceProvider is deprecated; inject IDataService instead |
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.
код нужно переписать.
|
|
||
| ``` csharp | ||
| var ds = (SQLDataService)DataServiceProvider.DataService; | ||
| var ds = (SQLDataService)DataServiceProvider.DataService; // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
| Дополнительно, необходимо отображать только работающих `КредитныхИнспекторов`. | ||
|
|
||
| 1.Построить ограничения, испльзуя LINQ-провайдер: | ||
| 1.Построить ограничения, испльзуя LINQ-провайдер: |
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.
Можно сразу опечатку поправить. "испОльзуя "
|
|
||
| ```csharp | ||
| var ds = (SQLDataService) DataServiceProvider.DataService; | ||
| var ds = (SQLDataService) DataServiceProvider.DataService; // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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 objects = eventArgs.PrimaryKeys.Select(x => new Город { __PrimaryKey = Guid.Parse(x) }) | ||
| .Cast<DataObject>().ToArray(); | ||
| DataServiceProvider.DataService.LoadObjects(objects, Город.Views.ГородL, true); | ||
| DataServiceProvider.DataService.LoadObjects(objects, Город.Views.ГородL, true); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
| // Если во время удаления произойдет ошибка, мы сможем ее обработать в блоке catch. | ||
| // Если АдресБС.cs найдет учреждения, ссылающиеся на удаляемый адрес, он кинет ConfirmAdresDeletingException. | ||
| ICSSoft.STORMNET.Business.DataServiceProvider.DataService.UpdateObject(args.DataObj); | ||
| ICSSoft.STORMNET.Business.DataServiceProvider.DataService.UpdateObject(args.DataObj); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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 ds = (SQLDataService)DataServiceProvider.DataService; | ||
| var ds = (SQLDataService)DataServiceProvider.DataService; // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
| }).ToArray<Адрес>(); | ||
| //Удаляем. (Дальнейшая обработка происходит в АдресБС) | ||
| DataServiceProvider.DataService.UpdateObjects(ref deletingAdreses); | ||
| DataServiceProvider.DataService.UpdateObjects(ref deletingAdreses); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
| { | ||
| // Инициализация сервиса аудита | ||
| AuditSetter.InitAuditService(BridgeToDS.GetDataService()); | ||
| IServiceProvider serviceProvider; // Используйте внедрение зависимостей чтобы получить IServiceProvider; вместо IServiceProvider можно использовать IUnityContainer |
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.
Нужно написать так, чтобы было понятно, откуда IServiceProvider serviceProvider;, а то такой фрагмент кода нерабочий.
| // Инициализация сервиса аудита | ||
| AuditSetter.InitAuditService(BridgeToDS.GetDataService()); | ||
| IServiceProvider serviceProvider; // Используйте внедрение зависимостей чтобы получить IServiceProvider; вместо IServiceProvider можно использовать IUnityContainer | ||
| var IAuditService = serviceProvider.GetService<IAuditService>(BridgeToDS.GetDataService()); |
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.
Нужно перепроверить, а существует ли вообще класс BridgeToDS. Тут вероятно нужно тоже через Unity резолвить.
|
|
||
| ```csharp | ||
| AuditService.Current.ShowPrimaryKey = true; | ||
| AuditService.Current.ShowPrimaryKey = true; // AuditService.Current удалён в ORM версии 8.0. Используйте внедрение зависимостей для инжекта IAuditService. |
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.
Переписать на корректный вариант.
|
|
||
| ```csharp | ||
| AuditService.Current.ShowPrimaryKey = false; | ||
| AuditService.Current.ShowPrimaryKey = false; // AuditService.Current удалён в ORM версии 8.0. Используйте внедрение зависимостей для инжекта IAuditService. |
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.
Аналогично.
| ``` | ||
| ##### В запросе с использованием LCS | ||
| ```c# | ||
| var ldef = ExternalLangDef.LanguageDef; // Использование ExternalLangDef.LanguageDef является устаревшим. Вместо него используйте конструктор (new ExternalLangDef(dataService)). |
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.
Переписать
| ``` csharp | ||
| dobj.DisableInitDataCopy(); // запрещаем инициализацию копии данных | ||
| ICSSoft.STORMNET.Business.DataServiceProvider.DataService.LoadObject(view, dobj, false, false); // дочитка объекта данных | ||
| // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
| dobj_forLoading.SetExistingPrimaryKey(dobj.__PrimaryKey); | ||
| // view - требуемое представление. Его состав зависит от задачи. | ||
| ICSSoft.STORMNET.Business.DataServiceProvider.DataService.LoadObject(view, dobj_forLoading); | ||
| ICSSoft.STORMNET.Business.DataServiceProvider.DataService.LoadObject(view, dobj_forLoading); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
|
|
||
| ```csharp | ||
| ICSSoft.STORMNET.Business.DataServiceProvider.DataService.LoadObject(dobj_forLoading); | ||
| ICSSoft.STORMNET.Business.DataServiceProvider.DataService.LoadObject(dobj_forLoading); // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
|
|
||
| ```csharp | ||
| using ICSSoft.STORMNET.Business; | ||
| var DS = DataServiceProvider.DataService as SQLDataService; // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
| cdbo.CustomOwnAttribute = new RandomStringGenerator().Generate(200); | ||
|
|
||
| IDataService dataService = DataServiceProvider.DataService; | ||
| IDataService dataService = DataServiceProvider.DataService; // DataServiceProvider устарел; вместо него используйте внедрение зависимостей |
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.
Переписать.
| --- | ||
|
|
||
| # AuditSetter | ||
| > AuditSetter отсутствует в ORM v8.0. Необходимо самостоятельно регистрировать IAuditService через механизм внедрения зависимостей. |
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.
Нужно написать, как теперь правильно.
| finally | ||
| { | ||
| // Update the transaction status in the database in accordance with the results of the report | ||
| AuditService.Current.RatifyAuditOperation( |
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.
Нужно переписать
| finally | ||
| { | ||
| // Обновим статус операции в базе в соответствии с результатами построения отчета | ||
| AuditService.Current.RatifyAuditOperation( |
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.
Переписать
| // Записываем операцию аудита в базу и запоминаем ID созданной записи | ||
| Guid? auditOperationId = AuditService.Current.WriteCustomAuditOperation(auditParams, true); | ||
| Guid? auditOperationId = AuditService.Current.WriteCustomAuditOperation(auditParams, true); // AuditService.Current удалён в ORM версии 8.0. Используйте внедрение зависимостей для инжекта IAuditService. |
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.
Переписать
| finally | ||
| { | ||
| // Обновим статус операции в базе в соответствии с результатами построения отчета | ||
| AuditService.Current.RatifyAuditOperation( |
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.
Переписать
| // Инициализация сервиса аудита | ||
| AuditSetter.InitAuditService(DataServiceProvider.DataService); | ||
| IUnityContainer container; // контейнер необходимо получить через внедрение зависимостей; вместо IUnityContainer можно использовать IServiceProvider |
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.
Нужен код получения контейнера
|
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 71 files out of 153 files are above the max files limit of 75. Please upgrade to Pro plan to get higher limits. You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
No description provided.