SimpleIoc.Default.Register fails at IsInDesignModeStatic if the Interface is in different assembly

前端 未结 1 948
后悔当初
后悔当初 2020-12-21 09:22

In the static constructor of ViewModelLocator class the SimpleIoc.Default.Register(); fails at IsInDesignModeStatic mode, if

相关标签:
1条回答
  • 2020-12-21 10:15
        if (ViewModelBase.IsInDesignModeStatic) {
    
    
            // put these lines here:
            if (SimpleIoc.Default.IsRegistered<IDataService>()) {
                SimpleIoc.Default.Unregister<IDataService>();
            }
    
            SimpleIoc.Default.Register<IDataService, Design.DesignDataService>();
        }
        else {
            SimpleIoc.Default.Register<IDataService, DataService>();
        }
    
    0 讨论(0)
提交回复
热议问题