C# Prism.Unity.Wpf问题:更新后缺少UnityServiceLocatorAdapter
在WPF应用程序中从7.2.0.1422版更新到8.0.0.1909版后,GetInstance方法不再有效: CommonServiceLocator.ServiceLocator.Current.GetInstance 发出消息:“必须设置ServiceLocationProvider” 我发现版本8缺少Prism.Unity.Wpf.UnityServiceLocatorAdapter类,该类在版本7中存在,并提供了ServiceLocator来工作。 问:我现在如何利用CommonServiceLocator.ServiceLocator.Current.GetInstance?Prism 8.0的状态发生了重大变化: 添加了ContainerLocator(注意:这将替换Prism.Wpf中的公共服务定位器) 所以,用棱镜8,你写C# Prism.Unity.Wpf问题:更新后缺少UnityServiceLocatorAdapter,c#,wpf,prism,C#,Wpf,Prism,在WPF应用程序中从7.2.0.1422版更新到8.0.0.1909版后,GetInstance方法不再有效: CommonServiceLocator.ServiceLocator.Current.GetInstance 发出消息:“必须设置ServiceLocationProvider” 我发现版本8缺少Prism.Unity.Wpf.UnityServiceLocatorAdapter类,该类在版本7中存在,并提供了ServiceLocator来工作。 问:我现在如何利用CommonSer
Prism.Ioc.ContainerLocator.Container
如果您必须访问容器…Prism 8.0的状态发生了变化:
添加了ContainerLocator(注意:这将替换Prism.Wpf中的公共服务定位器)
所以,用棱镜8,你写
Prism.Ioc.ContainerLocator.Container
如果您必须访问容器…我不理解您的问题。基本上,您和Prism不需要了解任何有关
CommonServiceLocator.ServiceLocator.Current.GetInstance
的信息。我不理解您的问题。基本上,您和Prism不需要了解任何有关CommonServiceLocator.ServiceLocator.Current.GetInstance
。谢谢。你的建议确实帮助了我。现在,不再使用\u eventAggregator=CommonServiceLocator.ServiceLocator.Current.GetInstance()代码>我执行一个调用:\u eventAggregator=(IEventAggregator)Prism.Ioc.ContainerLocator.Container.Resolve(typeof(IEventAggregator))代码>并且它工作!遗憾的是,旧的选择已被取消。它更简洁、更通用。无论如何,应该有一个通用的Resolve
变体,也许你错过了一个扩展方法??使用Prism.Ioc添加;应该能解决这个问题谢谢。你的建议确实帮助了我。现在,不再使用\u eventAggregator=CommonServiceLocator.ServiceLocator.Current.GetInstance()代码>我执行一个调用:\u eventAggregator=(IEventAggregator)Prism.Ioc.ContainerLocator.Container.Resolve(typeof(IEventAggregator))代码>并且它工作!遗憾的是,旧的选择已被取消。它更简洁、更通用。无论如何,应该有一个通用的Resolve
变体,也许你错过了一个扩展方法??使用Prism.Ioc添加;我们应该解决这个问题