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