Just put the constants in an open module inside your app_code folder or if you don't want to do this, just create classes in app_code and use the using (import) keyword to import the namespace (class name) in each and you can use it that way.
Alternatively, if it makes sense to do this, just add them to your view model - remember that it may not make sense to add these vars to your model, but it makes sense to add them to your view model! This is a view model, and this view model can capture constant values โโfrom a public module or class, or you can even set it in your real view model, so you will only define values โโin one place, and you do not need to use name import in each submission :)
Let me know how this happens, and if there is anything else I can do to help you.
In vb.net, but the same as csharp, and it is easy to understand, since it is vb.
Public class YourModel // this is where you have the normal model you have... No big deal End Class ... // now you make the view model urself ... Public class MyViewModel Public MyNormalModel as YourModel //notice we r declaring ur normal model as a variable, u can use a property instead Public MyPathConstant1 as string = "abc" Public MyPathConstant2 as string = "abc" Public MyPathConstant3 as string = "abc" End Class
Now you should set the value MyNormalModel for the instance of the current ur model, although you can do it in the ur controller, it is best to create a method inside the MyViewModel class that takes a copy of the current ur model as an argument and sets MyNormalModel to the current model, which we just passed in the argument.
You can still make this call in your controller, but on a different note, what people prefer to do, instead of passing the whole normal model as a property, just take the pieces and pieces that they need from the normal model and put them in the view (i.e. you may need only half the properties in the normal model for the view model). This is because, remember, the view model will be passed to the view, and they donโt want to convey what they donโt use :). But this means that you will need to set each of these properties one at a time most likely (unless those exact ones are encapsulated in a subclass that usually doesn't happen by chance lol).
I saved it in one so you can just copy the regular model in one shot for simplicity.
Now, when you pass the view model to your view (MyViewModel), you can use and access the normal model through the notation of the object and its properties, for example ... Model.MyNormalModel.Property1. Etc and do whatever you want with it in the view ... Alternatively, you can access the rest of your view model (the const values โโwe set) like this ... Model.MyPathConstant1 and Model.MyPathConstant2 and etc. So you have access to almost everything you want, the normal ur model and everything else that you added later through what is now called your view model.
Please excuse sealed letters and ipad lol. Let me know if that makes sense.