Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="ViewContext"/>.
        /// </summary>
        /// <param name="actionContext">The <see cref="ActionContext"/>.</param>
        /// <param name="view">The <see cref="IView"/> being rendered.</param>
        /// <param name="viewData">The <see cref="ViewDataDictionary"/>.</param>
        /// <param name="tempData">The <see cref="ITempDataDictionary"/>.</param>
        /// <param name="writer">The <see cref="TextWriter"/> to render output to.</param>
        public ViewContext(
            ActionContext actionContext,
            IView view,
            ViewDataDictionary viewData,
            ITempDataDictionary tempData,
            TextWriter writer,
            HtmlHelperOptions htmlHelperOptions)
            : base(actionContext)
        {
            if (actionContext == null)
            {
                throw new ArgumentNullException(nameof(actionContext));
            }

            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            if (viewData == null)
            {
                throw new ArgumentNullException(nameof(viewData));
            }

            if (tempData == null)
            {
                throw new ArgumentNullException(nameof(tempData));
            }

            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            if (htmlHelperOptions == null)
            {
                throw new ArgumentNullException(nameof(htmlHelperOptions));
            }

            View     = view;
            ViewData = viewData;
            TempData = tempData;
            Writer   = writer;

            _formContext                    = _defaultFormContext;
            ClientValidationEnabled         = htmlHelperOptions.ClientValidationEnabled;
            Html5DateRenderingMode          = htmlHelperOptions.Html5DateRenderingMode;
            ValidationSummaryMessageElement = htmlHelperOptions.ValidationSummaryMessageElement;
            ValidationMessageElement        = htmlHelperOptions.ValidationMessageElement;
        }
Esempio n. 2
0
 public MvcOptions()
 {
     Conventions = new List<IApplicationModelConvention>();
     ModelBinders = new List<IModelBinder>();
     ViewEngines = new List<ViewEngineDescriptor>();
     ValueProviderFactories = new List<IValueProviderFactory>();
     OutputFormatters = new List<IOutputFormatter>();
     InputFormatters = new List<IInputFormatter>();
     Filters = new List<IFilter>();
     FormatterMappings = new FormatterMappings();
     ValidationExcludeFilters = new List<IExcludeTypeValidationFilter>();
     ModelMetadataDetailsProviders = new List<IMetadataDetailsProvider>();
     ModelValidatorProviders = new List<IModelValidatorProvider>();
     ClientModelValidatorProviders = new List<IClientModelValidatorProvider>();
     CacheProfiles = new Dictionary<string, CacheProfile>(StringComparer.OrdinalIgnoreCase);
     HtmlHelperOptions = new HtmlHelperOptions();
     SerializerSettings = SerializerSettingsProvider.CreateSerializerSettings();
 }