Skip to content
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

Multiple use_cases share the same repository. The repository does not want to be set as a single instance. How can I do this? #490

Open
MySwallow opened this issue Jan 15, 2025 · 0 comments

Comments

@MySwallow
Copy link

MySwallow commented Jan 15, 2025

My current code is

@injectable
class MessageUseCase {
     MessageUseCase( this.repository);
}
@injectable
class HomeUseCase {
     HomeUseCase( this.repository);
}
@injectable
class PermissionUseCase {
     PermissionUseCase( this.repository);
}
@injectable
class HomeRepository {
}

Some attempts to use scope seem to have no effect.

@Injectable(scope: 'home')
class MessageUseCase {
     MessageUseCase( this.repository);
}
@Injectable(scope: 'home')
class HomeUseCase {
     HomeUseCase( this.repository);
}

@Injectable(scope: 'home')
class PermissionUseCase {
     PermissionUseCase( this.repository);
}

@Injectable(scope: 'home')
class HomeRepository {
}

How to use Injectable to achieve the effect I need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant