Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

* Introduce _GlobalImports to inherit directives. #2020

Closed
wants to merge 2 commits into from
Closed

Conversation

pranavkm
Copy link
Contributor

  • Remove inheritance from _ViewStarts

Fixes #825

@ghost ghost added the cla-not-required label Feb 16, 2015
namespace Microsoft.AspNet.Mvc.Razor
{
/// <summary>
/// Contains methods to locate <c>_ViewStart.cshtml</c> and <c>_Global.cshtml</c>
Copy link
Contributor

Choose a reason for hiding this comment

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

_GlobalImpot.cshtml

@NTaylorMullen
Copy link
Contributor

Pretty much there, ⌚

* Remove inheritance from _ViewStarts

Fixes #825
@pranavkm
Copy link
Contributor Author

Updated.

@@ -126,20 +124,33 @@ public class PrecompilationTest
Assert.NotEqual(response6.Layout, response7.Layout);

// Act - 8
// Refetch and verify we get cached types
// Remove new _ViewStart file
Copy link
Contributor

Choose a reason for hiding this comment

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

Lies

@NTaylorMullen
Copy link
Contributor

Looks good to me :shipit:

@Shazwazza
Copy link
Contributor

Just for anyone that's come across this thread or #881, the new way is to have a file called:

_GlobalImport.cshtml (no 's' on the end) to 'globally' inject services into views which can exist at any view folder hierarchy or so it seems.

@dtkujawski
Copy link

To add to what @Shazwazza wrote above - this also seems to support the @inherits directive. So, you can derive your views from a base class globally without having to put @inherits at the top of each view.

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

Successfully merging this pull request may close these issues.

5 participants