This repository has been archived by the owner. It is now read-only.

Alternative for Environment TagHeper domain #5671

Closed
Eilon opened this Issue Jan 9, 2017 · 8 comments

Comments

Projects
None yet
4 participants
@Eilon
Copy link
Member

Eilon commented Jan 9, 2017

From @vkichline on October 8, 2015 22:32

I see this pattern in the Web Application template's _ValidationScriptsPartial.cshtml:

<environment names="Development">
       …
</environment>
<environment names="Staging,Production">
       …
</environment>

This pattern above seems brittle; if I add a new environment setting, I have a lot of searching and modification to do.

I wish I had something like:

<environment names="Development">
       …
</environment>
<environment names="!Development">
       …
</environment>

…or:

<environment names="Development">
       …
<else>
       …
</environment>

Copied from original issue: aspnet/Razor#567

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Jan 9, 2017

The <else> thing can't be done because it's not valid syntax.

But something like this can certainly be done:

<environment names="Development">
    <true>
       …
    </true>
    <false>
       …
    </false>
</environment>

@Eilon Eilon added the enhancement label Jan 9, 2017

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Jan 9, 2017

(Not saying it's worth it or that it's a good idea, but it's implementable.)

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Jan 9, 2017

Another alternative to consider would be something like:

<environment names="Development">
       …
</environment>
<environment names="Development" behavior="OppositeDay">
       …
</environment>

Or at least something like that.

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Jan 11, 2017

Another option to consider:

Another alternative to consider would be something like:

<environment names="Development">
       …
</environment>
<environment excludeNames="Development">
       …
</environment>

And you can't set both names and excludeNames.

@DamianEdwards thoughts on this? I think this could clean up the default templates. And, of course, Hubbup.

@DamianEdwards

This comment has been minimized.

Copy link
Member

DamianEdwards commented Jan 11, 2017

maybe:

<environment include="Development">
    ...
</environment>
<environment exclude="Development">
    ...
</environment>

And keep support for names as it is now.

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Jan 11, 2017

Yeah I dig this. @danroth27 totally digs this too.

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Jan 11, 2017

Let's go with @DamianEdwards 's suggestion in #5671 (comment).

@Eilon Eilon added the 1 - Ready label Jan 11, 2017

@Eilon Eilon added this to the 2.0.0 milestone Jan 11, 2017

@grahamehorner

This comment has been minimized.

Copy link

grahamehorner commented Jan 20, 2017

@Eilon @DamianEdwards or maybe

options are may


<environment>
<case names="..." include=true>
</case>
<case names="..." include=false>
</case>
<default>
</default>
</environment>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.