Problem
Workspace/WorkspaceViewModel.cs has two rule violations:
1. AccountEntity used directly in ViewModel
AccountEntity (a persistence model) is imported and used in MapToViewModel(AccountEntity entity). Per onedrive-viewmodels.md: "*Entity types are never used in ViewModels or views. Mapping from *Entity → domain model occurs in the service layer."
Fix: Introduce a service/factory that returns IReadOnlyList<OneDriveAccount> (domain models). WorkspaceViewModel consumes domain models only. Remove MapToViewModel(AccountEntity) from the ViewModel.
2. IServiceProvider injected (service locator pattern — banned)
IServiceProvider is injected and _serviceProvider.GetRequiredService<AddAccountWizardViewModel>() is called inside the ViewModel. Per onedrive-di.md: "Service locator pattern — never inject IServiceProvider into business logic."
Fix: Replace IServiceProvider injection with Func<AddAccountWizardViewModel> wizardFactory and call wizardFactory() in ExecuteOpenAddAccountWizard.
3. Hardcoded real-looking email addresses
Design-time sample data at lines ~176–224 includes jason@outlook.com, jason.barden@work.com, jane@dev.io, jason@sideproject.io. Even for design-time data, real-looking PII should not be committed to source. Replace with obviously fictional values (user@example.com, alice@example.com).
Rule reference
@.claude/rules/onedrive-viewmodels.md — Domain model isolation; @.claude/rules/onedrive-di.md — What is banned
Problem
Workspace/WorkspaceViewModel.cshas two rule violations:1.
AccountEntityused directly in ViewModelAccountEntity(a persistence model) is imported and used inMapToViewModel(AccountEntity entity). Peronedrive-viewmodels.md: "*Entitytypes are never used in ViewModels or views. Mapping from*Entity→ domain model occurs in the service layer."Fix: Introduce a service/factory that returns
IReadOnlyList<OneDriveAccount>(domain models).WorkspaceViewModelconsumes domain models only. RemoveMapToViewModel(AccountEntity)from the ViewModel.2.
IServiceProviderinjected (service locator pattern — banned)IServiceProvideris injected and_serviceProvider.GetRequiredService<AddAccountWizardViewModel>()is called inside the ViewModel. Peronedrive-di.md: "Service locator pattern — never injectIServiceProviderinto business logic."Fix: Replace
IServiceProviderinjection withFunc<AddAccountWizardViewModel> wizardFactoryand callwizardFactory()inExecuteOpenAddAccountWizard.3. Hardcoded real-looking email addresses
Design-time sample data at lines ~176–224 includes
jason@outlook.com,jason.barden@work.com,jane@dev.io,jason@sideproject.io. Even for design-time data, real-looking PII should not be committed to source. Replace with obviously fictional values (user@example.com,alice@example.com).Rule reference
@.claude/rules/onedrive-viewmodels.md— Domain model isolation;@.claude/rules/onedrive-di.md— What is banned