Skip to content

Instantly share code, notes, and snippets.

@mr5z
Last active March 1, 2019 13:29
Show Gist options
  • Save mr5z/9492582e08fcc03ddc65d664228b7a72 to your computer and use it in GitHub Desktop.
Save mr5z/9492582e08fcc03ddc65d664228b7a72 to your computer and use it in GitHub Desktop.
circular dependency in IoC
class AuthService : IAuthService
{
AuthService(IDataService dataService) { }
void RequestAuth()
{
var result = dataService.PostAsync(...)
}
}
class HttpDataService : IDataService
{
HttpClient httpClient = ...
HttpDataService(IAuthService authService) { }
Task<TResult> GetAsync(...) { ... }
Task<TResult> PostAsync(...) { ... }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment