Skip to content

The dreaded "Deprecated" and "Obsolete" #4091

Answered by bdukes
thabaum asked this question in General
Discussion options

You must be logged in to vote

For these deprecations where we're moving from Whatever.Instance to IWhatever, to resolve the warning you need to start retrieving the interface via dependency injection. Exactly how you do that will depend a lot on which part of the code you're in. If you're looking at a Web API controller (e.g. in the Persona Bar code), you can just add an additional constructor dependency and DI will fill it in automatically. For instance,

public class ServerSettingsSmtpHostController : PersonaBarApiController
{
    private readonly IHostSettingsService hostSettingsService;

    public ServerSettingsSmtpHostController(IHostSettingsService hostSettingsService)
    {
        this.hostSettingsService = ho…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@thabaum
Comment options

Comment options

You must be logged in to vote
1 reply
@SkyeHoefling
Comment options

Answer selected by thabaum
Comment options

You must be logged in to vote
4 replies
@bdukes
Comment options

@SkyeHoefling
Comment options

@thabaum
Comment options

@SkyeHoefling
Comment options

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