Skip to content

Replace IHostingEnvironment with IWebHostEnvironment - #7725

Merged
Tratcher merged 2 commits into
masterfrom
tratcher/hosting
Feb 20, 2019
Merged

Tratcher merged 2 commits into
masterfrom
tratcher/hosting

Conversation

@Tratcher

@Tratcher Tratcher commented Feb 19, 2019 •

Copy link
Copy Markdown
Member

This is the second half of dotnet/extensions#966

IHostingEnvironment is replaced by IWebHostEnvironment
IApplicationEnvironment is replaced by Extensions.Hosting.IHostApplicationEnvironment

Due to the size and timing of this PR nits in samples or tests are unlikely to be addressed.

Also, there are quite a few public constructors that were modified. These are primarily invoked by DI and there is little end-user impact. I'm not keeping the old constructors as the old types are not convertible to the new types. Removing the old constructors seems preferable to obsoleting them with an error.

@JunTaoLuo

Copy link
Copy Markdown
Contributor

:shipit: When tests pass.

{
public static class HostingEnvironmentExtensions
{
#pragma warning disable CS0618 // Type or member is obsolete

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dunno why this was made public in the first place.

@Tratcher
Tratcher merged commit 4e44025 into master Feb 20, 2019
@Tratcher
Tratcher deleted the tratcher/hosting branch February 20, 2019 05:11
@tebeco

tebeco commented Feb 20, 2019

Copy link
Copy Markdown
Contributor

dumb question but why not align interface name ?
IXxxHostEnvironment or IHostYyyEnvironment

when people are going to find IHostApplicationEnvironment it will probably NOT be straightforward to think that you actually have to backspace back to I to re-type Web

that’s a really naive question there are probably tons of better reason than doing
IWebHostEnvironment
IApplicationHostEnvironment

or
IHostWebEnvironnent
IHostApplicationEnvironment

@Tratcher

Copy link
Copy Markdown
Member Author

The new types are:
IHostEnvironment
IWebHostEnvironment
IHostApplicationLifetime

IHostWebEnvironment doesn't convey any more meaning.

IApplicationHostLifetime sounds slightly better than IHostApplicationLifetime. @davidfowl @glennc?

@Tratcher

Copy link
Copy Markdown
Member Author

Announcement posted. #7749

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-hosting Includes Hosting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants