1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
14 using System.Diagnostics.CodeAnalysis;
\r
16 public class ViewPage<TModel> : ViewPage where TModel : class {
\r
18 private ViewDataDictionary<TModel> _viewData;
\r
20 public new AjaxHelper<TModel> Ajax {
\r
25 public new HtmlHelper<TModel> Html {
\r
30 public new TModel Model {
\r
32 return ViewData.Model;
\r
36 [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
\r
37 public new ViewDataDictionary<TModel> ViewData {
\r
39 if (_viewData == null) {
\r
40 SetViewData(new ViewDataDictionary<TModel>());
\r
49 public override void InitHelpers() {
\r
52 Ajax = new AjaxHelper<TModel>(ViewContext, this);
\r
53 Html = new HtmlHelper<TModel>(ViewContext, this);
\r
56 protected override void SetViewData(ViewDataDictionary viewData) {
\r
57 _viewData = new ViewDataDictionary<TModel>(viewData);
\r
59 base.SetViewData(_viewData);
\r