Reputation: 285
I have an ASP.net MVC 3 project with resource files setup in folders like:
/Resources/EntityName/Views/
/Resources/EntityName/Models/
This means the namespace to access the strongly typed resource values is:
Resources.EntityName.Models.ModelA.Property1
Visual studio gives a compile time error if I try to include the namespace "resources.xxx" and it won't allow the using alias syntax either.
Is there anyway to include or atleast alias the strongly typed namespace of a resource file like it was a normal namespace?
Upvotes: 1
Views: 825
Reputation: 23300
You might try something like this (not tested, just an idea)
public class myModelA : Resources.EntityName.Models.ModelA
{ /*Leave empty here, nothing to do*/ }
Then you may be able to call the shortest myModelA
instead of the complete, verbose name of the resource. Watch out because you'll not be able to access private
members of your original model if you inherit it like thi.
Upvotes: 0
Reputation: 8393
There should be no reason why you can't use one of these objects within a class:
using YourProject.Resources.EntityName.Models;
Upvotes: 1