Reputation: 383
In my views I need to add a reference to another class/ resource files.
I add to each view
@using Demo.Extensions;
and to add resource reference to views I do this:
@using Resources;
This does work, just annoying to add to each view. Is it possible to add reference once somewhere, web.config i think. so I dont need to worry about adding to each views
Upvotes: 4
Views: 3584
Reputation: 9901
In /Views/Web.config
(not root) you can include your namespace so that it will be included in all of your views.
<system.web.webPages.razor>
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="PATH_TO_YOUR_NAMSPACE" />
</namespaces>
</pages>
</system.web.webPages.razor>
Upvotes: 4