[英]Configuration and Views
I've been developing an application using asp.net MVC, and I have some configurations that influences in process of render a view. 我一直在使用asp.net MVC开发应用程序,并且有一些配置会影响渲染视图的过程。 For example, a user can choose (in an configuration of system) if a field should appear for a management of records in an area of the system. 例如,用户可以选择(在系统配置中)是否应显示用于管理系统区域中的记录的字段。 So, I have an class called AppConfiguration has some properties to represent this configurations. 因此,我有一个名为AppConfiguration的类,该类具有一些属性来表示此配置。
I guess I need to cache an object of AppConfiguration, and make a ViewModel base class and inherits from my viewmodel, for example: 我想我需要缓存一个AppConfiguration对象,并创建一个ViewModel基类并从我的viewmodel继承,例如:
public class BaseViewModel {
public AppConfiguration Config { get; set; }
}
public class DocumentViewModel : BaseViewModel {
public Document Document { get; set; }
}
and make typed views using "DocumentViewModel" to check the properties if this kind of document is able to render or not ? 并使用“ DocumentViewModel”创建类型化的视图以检查属性是否可以呈现此类文档? is it works ? 可行吗? Or is there any other better way to do something like this ? 还是有其他更好的方法可以做这样的事情?
Thanks all and sorry for my english! 谢谢大家,对不起我的英语!
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.