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

Support @Inject, @model, @using declaration in viewstart #881

Closed
pranavkm opened this issue Jul 28, 2014 · 3 comments
Closed

Support @Inject, @model, @using declaration in viewstart #881

pranavkm opened this issue Jul 28, 2014 · 3 comments
Assignees
Milestone

Comments

@pranavkm
Copy link
Contributor

Related discussion: #825

The plan is to have any directives declared in _ViewStart affect pages in the hierarchy. For instance @using MyNamespace declared in the root _ViewStart wouid cause a using MyNamespace; to be generated in all views in the application.

The merge strategy happens on a per-directive basis - for instance for @Inject are merged by name@inject FooType Html in _ViewStart and @inject BarType Html in the page would result in the latter being chosen.

The token TModel would represent the model of the current page. When adding a directive to a page, the token would be replaced by the value specified by @model.

@pranavkm pranavkm added this to the 6.0.0-beta1 milestone Jul 28, 2014
@pranavkm pranavkm self-assigned this Jul 28, 2014
@pranavkm pranavkm modified the milestones: 6.0.0-alpha4, 6.0.0-beta1 Aug 29, 2014
@yishaigalatzer yishaigalatzer changed the title Propogate directives declared in _ViewStart pages to items under it. Support @Inject, @model, @using declaration in viewstart Sep 29, 2014
@Shazwazza
Copy link
Contributor

I had this working a very long time ago but have upgraded my sln to dnx and MVC6 beta4 and no the @Inject on a _ViewStart page doesn't seem to propagate to views using it. It could be something I'm doing wrong or is it a known issue?

@pranavkm
Copy link
Contributor Author

@Shazwazza we added a new file _GlobalImport.cshtml to import these directives. The idea was to avoid repurposing _ViewStart to support this feature. See - #2020

@Shazwazza
Copy link
Contributor

great thanks, will give it a try

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

No branches or pull requests

3 participants