开发者

Configuration and Views

I've been dev开发者_StackOverfloweloping an application using asp.net MVC, and I have some configurations that influences in process of render a view. 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.

I guess I need to cache an object of AppConfiguration, and make a ViewModel base class and inherits from my viewmodel, for example:

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 ? is it works ? Or is there any other better way to do something like this ?

Thanks all and sorry for my english!

Cheers


I'd suggest that you write an associated metadata provider for your view model and then use default templated views in MVC 2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜