Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

DependencyService への依存を削除(CommonServiceLocator 不使用版) #60

Closed
wants to merge 8 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Mar 16, 2021

Issue 番号 / Issue ID

目的 / Purpose

  • 現状は DependencyService と Prism Ioc を混在使用してしまっているので、DependencyService への依存を削除します。
    PR DependencyService への依存を削除 #46 のリライトですが、CommonServiceLocator を使うのをやめて、Prism8.0 から ContainerLocator を backport する対応にしてみました

破壊的変更をもたらしますか / Does this introduce a breaking change?

[x] Yes
[ ] No

機能追加ではないものの、一部クラスのコンストラクタに引数を追加しています。

Pull Request の種類 / Pull Request type

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

検証方法 / How to test

コードの入手 / Get the code

git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
dotnet restore

コードの検証 / Test the code


確認事項 / What to check

その他 / Other information

対応内容は以下のようにしています

  • App.xaml.cs では Container.Resolve を呼び出していますがこれは Prism.Ioc を経由すると思いますのでそのまま使用しています
  • ViewModel についてはすでに Prism の AutowireViewModels を使用していますので、DependencyService で取得する処理は不要で、コンストラクタでインジェクションするようにしました
  • LogPeriodicDeleteService については、共有の Covid19Radar 部分の実装は単に proxy しているだけで不要で、インタフェースも重複使用されていたので削除しました
  • Logs/ のいくつかのクラスで DependencyService からインスタンスを取得していたのでコンストラクタでインジェクションするようにしました
  • ExposureNotificationHander は Xamarin.EN 内部で生成されてしまうため DI の対象になっておらず、また、Android 版では  App クラスへも依存できないので、DryIoc.CommonServiceLocator を導入 ContainerLocator クラスを backport しました
  • Prism8.0 に更新する際には標準の ContainerLocator に実装を差し替えることで Covid19Rader.Common に追加した ContainerLocator は不要になります

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DependencyService と Prism.Ioc を混在して使用している
1 participant