2010-06-21 Marek Habersack <mhabersack@novell.com>
[mcs.git] / class / System.Web.Mvc / System.Web.Mvc / ViewContext.cs
blobc691d59c9926deb75980201b080eee16f99e37e6
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;
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");
30 if (view == null) {
31 throw new ArgumentNullException("view");
33 if (viewData == null) {
34 throw new ArgumentNullException("viewData");
36 if (tempData == null) {
37 throw new ArgumentNullException("tempData");
40 View = view;
41 ViewData = viewData;
42 TempData = tempData;
45 public virtual IView View {
46 get;
47 set;
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 {
53 get;
54 set;
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 {
60 get;
61 set;