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
{
15 using System
.Diagnostics
.CodeAnalysis
;
17 public class ViewContext
: ControllerContext
{
19 // parameterless constructor used for mocking
20 public ViewContext() {
23 [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors",
24 Justification
= "The virtual property setters are only to support mocking frameworks, in which case this constructor shouldn't be called anyway.")]
25 public ViewContext(ControllerContext controllerContext
, IView view
, ViewDataDictionary viewData
, TempDataDictionary tempData
)
26 : base(controllerContext
) {
27 if (controllerContext
== null) {
28 throw new ArgumentNullException("controllerContext");
31 throw new ArgumentNullException("view");
33 if (viewData
== null) {
34 throw new ArgumentNullException("viewData");
36 if (tempData
== null) {
37 throw new ArgumentNullException("tempData");
45 public virtual IView View
{
50 [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly",
51 Justification
= "The property setter is only here to support mocking this type and should not be called at runtime.")]
52 public virtual ViewDataDictionary ViewData
{
57 [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly",
58 Justification
= "The property setter is only here to support mocking this type and should not be called at runtime.")]
59 public virtual TempDataDictionary TempData
{