24 writes to ViewData
Microsoft.AspNetCore.Mvc.Razor (1)
RazorPagePropertyActivator.cs (1)
48
context.
ViewData
= CreateViewDataDictionary(context);
Microsoft.AspNetCore.Mvc.Razor.Test (11)
Compilation\RazorPagePropertyActivatorTest.cs (6)
66
ViewData
= original,
95
ViewData
= original,
124
ViewData
= original,
153
ViewData
= original,
182
ViewData
= original,
206
ViewData
= original,
RazorPageCreateModelExpressionTest.cs (3)
30
viewContext.
ViewData
= viewData;
55
viewContext.
ViewData
= viewData;
109
viewContext.
ViewData
= viewData;
RazorViewTest.cs (2)
83
c.
ViewData
= viewData;
126
c.
ViewData
= viewData;
Microsoft.AspNetCore.Mvc.RazorPages.Test (6)
Infrastructure\DefaultPageFactoryProviderTest.cs (1)
230
ViewData
= pageContext.ViewData,
PageTest.cs (5)
1718
ViewData
= viewData
1743
ViewData
= viewData
1768
ViewData
= viewData,
1790
ViewData
= viewData,
1812
ViewData
= viewData,
Microsoft.AspNetCore.Mvc.TagHelpers.Test (1)
LabelTagHelperTest.cs (1)
297
viewContext.
ViewData
= viewData;
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
Rendering\ViewContext.cs (3)
34
ViewData
= new ViewDataDictionary(new EmptyModelMetadataProvider(), ModelState);
64
ViewData
= viewData;
106
ViewData
= viewData;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
Rendering\HtmlHelperTest.cs (1)
338
viewContext.
ViewData
= new ViewDataDictionary(viewContext.ViewData);
Rendering\ViewContextTests.cs (1)
33
context.
ViewData
= replacementViewData;
155 references to ViewData
Identity.ExternalClaims (1)
Pages\Account\Manage\ManageNavPages.cs (1)
32
var activePage = viewContext.
ViewData
["ActivePage"] as string
Microsoft.AspNetCore.Identity.UI (4)
Areas\Identity\Pages\V4\Account\Manage\ManageNavPages.cs (2)
116
var activePage = viewContext.
ViewData
["ActivePage"] as string
175
var activePage = viewContext.
ViewData
["ActivePage"] as string
Areas\Identity\Pages\V5\Account\Manage\ManageNavPages.cs (2)
116
var activePage = viewContext.
ViewData
["ActivePage"] as string
175
var activePage = viewContext.
ViewData
["ActivePage"] as string
Microsoft.AspNetCore.Mvc.Razor (5)
RazorPagePropertyActivator.cs (5)
61
if (context.
ViewData
== null)
66
else if (context.
ViewData
.GetType() != _viewDataDictionaryType)
69
return _nestedFactory(context.
ViewData
);
72
return context.
ViewData
;
97
valueAccessor = context => context.
ViewData
;
Microsoft.AspNetCore.Mvc.Razor.Test (21)
DefaultTagHelperFactoryTest.cs (1)
37
viewContext.
ViewData
.Add("TestData", viewDataValue);
Infrastructure\DefaultTagHelperActivatorTest.cs (1)
29
viewContext.
ViewData
.Add("TestData", viewDataValue);
RazorPageActivatorTest.cs (8)
65
Assert.Same(viewContext.
ViewData
, instance.ViewData);
103
Assert.NotNull(viewContext.
ViewData
);
130
Assert.Same(viewContext.
ViewData
, instance.ViewData);
133
Assert.NotSame(viewData, viewContext.
ViewData
);
186
Assert.Same(viewContext.
ViewData
, page.ViewData);
187
Assert.NotSame(viewData, viewContext.
ViewData
);
189
Assert.IsType<ViewDataDictionary<Guid>>(viewContext.
ViewData
);
190
Assert.Equal("value", viewContext.
ViewData
["key"]);
RazorPageCreateModelExpressionTest.cs (9)
24
var modelExplorer = viewContext.
ViewData
.ModelExplorer.GetExplorerForProperty(
26
var viewData = new ViewDataDictionary<string>(viewContext.
ViewData
)
49
var modelExplorer = viewContext.
ViewData
.ModelExplorer.GetExplorerForProperty(
51
var viewData = new ViewDataDictionary<string>(viewContext.
ViewData
)
108
var viewData = new ViewDataDictionary<RecursiveModel>(viewContext.
ViewData
);
278
ViewData = (ViewDataDictionary<string>)viewContext.
ViewData
,
288
ViewData = (ViewDataDictionary<RecursiveModel>)viewContext.
ViewData
,
298
ViewData = (ViewDataDictionary<RazorPageCreateModelExpressionModel>)viewContext.
ViewData
,
365
return ModelExpressionProvider.CreateModelExpression(ViewData, m => ViewContext.
ViewData
.Model);
RazorViewTest.cs (2)
65
Assert.Same(viewData, v.ViewContext.
ViewData
);
103
Assert.Same(viewData, v.ViewContext.
ViewData
);
Microsoft.AspNetCore.Mvc.RazorPages (3)
PageBase.cs (3)
1185
var viewData = new ViewDataDictionary(MetadataProvider, ViewContext.
ViewData
.ModelState)
1241
ViewData = ViewContext.
ViewData
,
1263
ViewData = ViewContext.
ViewData
,
Microsoft.AspNetCore.Mvc.RazorPages.Test (4)
Infrastructure\PageActionInvokerTest.cs (4)
200
Assert.IsType<ViewDataDictionary<TestPage>>(page.ViewContext.
ViewData
);
201
Assert.Same(page, page.ViewContext.
ViewData
.Model);
206
Assert.Same(page.ViewContext.
ViewData
, pageResult.ViewData);
262
Assert.Same(page.ViewContext.
ViewData
, pageResult.ViewData);
Microsoft.AspNetCore.Mvc.TagHelpers (6)
InputTagHelper.cs (1)
213
string.IsNullOrEmpty(ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix) &&
PartialTagHelper.cs (2)
177
return ViewContext.
ViewData
.Model;
201
var baseViewData = ViewData ?? ViewContext.
ViewData
;
SelectTagHelper.cs (1)
136
string.IsNullOrEmpty(ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix) &&
TextAreaTagHelper.cs (1)
74
string.IsNullOrEmpty(ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix) &&
ValidationMessageTagHelper.cs (1)
64
string.IsNullOrEmpty(ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix) &&
Microsoft.AspNetCore.Mvc.TagHelpers.Test (20)
PartialTagHelperTest.cs (17)
91
viewContext.
ViewData
.Model = expectedModel;
235
viewContext.
ViewData
["key"] = expected;
241
v.Writer.Write(v.
ViewData
["key"]);
279
viewContext.
ViewData
["key"] = "ViewContext";
285
v.Writer.Write(v.
ViewData
["key"]);
326
viewContext.
ViewData
.Model = new object();
332
var actual = Assert.IsType<PropertyModel>(v.
ViewData
.Model);
373
viewContext.
ViewData
.Model = new object();
379
Assert.Null(v.
ViewData
.Model);
420
viewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "order.items[0]";
426
Assert.Equal(expected, v.
ViewData
.TemplateInfo.HtmlFieldPrefix);
449
Assert.Equal("order.items[0]", viewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix);
460
viewContext.
ViewData
.Model = model;
466
Assert.Same(model, v.
ViewData
.Model);
499
viewContext.
ViewData
.Model = model;
500
viewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = expected;
506
Assert.Equal(expected, v.
ViewData
.TemplateInfo.HtmlFieldPrefix);
SelectTagHelperTest.cs (2)
498
viewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = nameAndId.Name;
581
viewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = propertyName;
ValidationSummaryTagHelperTest.cs (1)
172
viewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = prefix;
Microsoft.AspNetCore.Mvc.ViewFeatures (38)
DefaultEditorTemplates.cs (1)
222
value: htmlHelper.ViewContext.
ViewData
.TemplateInfo.FormattedModelValue.ToString(),
DefaultHtmlGenerator.cs (21)
562
ExpressionMetadataProvider.FromStringExpression(expression, viewContext.
ViewData
, _metadataProvider);
582
if (viewContext.
ViewData
.ModelState.TryGetValue(fullName, out var entry))
632
viewContext.
ViewData
.ModelState.TryGetValue(fullName, out var entry);
665
AddPlaceholderAttribute(viewContext.
ViewData
, tagBuilder, modelExplorer, expression);
666
AddMaxLengthAttribute(viewContext.
ViewData
, tagBuilder, modelExplorer, expression);
735
if (!viewContext.
ViewData
.ModelState.ContainsKey(fullName) && formContext == null)
740
var tryGetModelStateResult = viewContext.
ViewData
.ModelState.TryGetValue(fullName, out var entry);
779
viewContext.
ViewData
,
810
var viewData = viewContext.
ViewData
;
918
rawValue = viewContext.
ViewData
.Eval(expression);
955
ExpressionMetadataProvider.FromStringExpression(expression, viewContext.
ViewData
, _metadataProvider);
1030
return Convert.ToString(viewContext.
ViewData
.Eval(key, format), CultureInfo.CurrentCulture);
1066
if (viewContext.
ViewData
.ModelState.TryGetValue(key, out var entry) && entry.RawValue != null)
1176
AddPlaceholderAttribute(viewContext.
ViewData
, tagBuilder, modelExplorer, expression);
1181
AddMaxLengthAttribute(viewContext.
ViewData
, tagBuilder, modelExplorer, expression);
1262
if (viewContext.
ViewData
.ModelState.TryGetValue(fullName, out var entry) && entry.Errors.Count > 0)
1373
viewContext.
ViewData
,
1410
return Convert.ToBoolean(viewContext.
ViewData
.Eval(key), CultureInfo.InvariantCulture);
1415
return Convert.ToString(viewContext.
ViewData
.Eval(key), CultureInfo.CurrentCulture);
1494
var value = viewContext.
ViewData
.Eval(expression);
1497
if (value == null || value == viewContext.
ViewData
.Model)
HtmlHelper.cs (1)
113
public ViewDataDictionary ViewData => ViewContext.
ViewData
;
HtmlHelperOfT.cs (8)
52
if (viewContext.
ViewData
== null)
55
nameof(ViewContext.
ViewData
),
60
ViewData = viewContext.
ViewData
as ViewDataDictionary<TModel>;
70
var runtimeType = viewContext.
ViewData
.ModelMetadata.ModelType;
73
ViewData = new ViewDataDictionary<TModel>(viewContext.
ViewData
, viewContext.
ViewData
.Model);
81
nameof(ViewContext.
ViewData
),
82
viewContext.
ViewData
.GetType().FullName,
NameAndIdProvider.cs (1)
130
var htmlFieldPrefix = viewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix;
Rendering\ViewContext.cs (1)
168
_viewBag = new DynamicViewData(() =>
ViewData
);
ValidationHtmlAttributeProvider.cs (1)
67
var fullName = viewContext.
ViewData
.TemplateInfo.GetFullHtmlFieldName(expression);
ViewComponentResultExecutor.cs (1)
139
viewDataValuesProvider?.ProvideViewDataValues(viewContext.
ViewData
);
ViewComponents\ViewComponentContext.cs (2)
61
new ViewDataDictionary<object>(viewContext.
ViewData
),
103
public ViewDataDictionary ViewData => ViewContext.
ViewData
;
ViewExecutor.cs (1)
236
viewDataValuesProvider?.ProvideViewDataValues(viewContext.
ViewData
);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (51)
DefaultHtmlGeneratorTest.cs (8)
499
viewContext.
ViewData
[nameof(Model.Name)] = Enumerable.Empty<SelectListItem>();
522
viewContext.
ViewData
[nameof(Model.Name)] = value;
589
viewContext.
ViewData
[nameof(Model.Name)] = "ignored ViewData value";
617
viewContext.
ViewData
[nameof(Model.Name)] = "ignored ViewData value";
665
viewContext.
ViewData
[nameof(Model.Name)] = "ignored ViewData value";
693
viewContext.
ViewData
[nameof(Model.Name)] = rawValue;
771
viewContext.
ViewData
[nameof(Model.Collection)] = new[] { "ignored ViewData value" };
800
viewContext.
ViewData
[nameof(Model.Collection)] = rawValue;
Rendering\DefaultTemplatesUtilities.cs (1)
311
await v.Writer.WriteAsync(FormatOutput(v.
ViewData
.ModelExplorer));
Rendering\HtmlHelperCheckboxTest.cs (4)
486
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
506
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
527
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
731
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
Rendering\HtmlHelperDisplayExtensionsTest.cs (13)
52
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
["SomeProperty"].ToString()))
135
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.FormattedModelValue.ToString()))
161
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.FormattedModelValue.ToString()))
187
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
["SomeProperty"].ToString()))
215
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.HtmlFieldPrefix))
243
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
["SomeProperty"].ToString()))
290
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
["SomeProperty"].ToString()))
321
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.FormattedModelValue.ToString()))
362
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.FormattedModelValue.ToString()))
387
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.HtmlFieldPrefix))
415
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
["SomeProperty"].ToString()))
462
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
["SomeProperty"].ToString()))
489
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.HtmlFieldPrefix))
Rendering\HtmlHelperEditorExtensionsTest.cs (2)
19
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.FormattedModelValue.ToString()))
45
.Callback((ViewContext v) => v.Writer.WriteAsync(v.
ViewData
.TemplateInfo.FormattedModelValue.ToString()))
Rendering\HtmlHelperHiddenTest.cs (6)
342
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
357
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
375
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
406
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
683
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
702
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
Rendering\HtmlHelperPasswordTest.cs (4)
100
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
118
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
133
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
275
helper.ViewContext.
ViewData
.TemplateInfo.HtmlFieldPrefix = "MyPrefix";
Rendering\HtmlHelperTest.cs (3)
319
var expectedMessage = $"Property '{nameof(ViewContext.
ViewData
)}' is of type " +
338
viewContext.ViewData = new ViewDataDictionary(viewContext.
ViewData
);
340
var expectedMessage = $"Property '{nameof(ViewContext.
ViewData
)}' is of type " +
Rendering\ViewContextTests.cs (5)
37
Assert.NotSame(originalViewData, context.
ViewData
);
38
Assert.Same(replacementViewData, context.
ViewData
);
41
Assert.Equal("property", context.
ViewData
["Another"]);
57
var viewData = new ViewDataDictionary(originalContext.
ViewData
);
77
Assert.Same(viewData, context.
ViewData
);
ViewComponents\ViewComponentContextTest.cs (1)
51
Assert.Same(viewComponentContext.ViewContext.
ViewData
, viewComponentContext.ViewData);
ViewComponentTests.cs (3)
226
Assert.NotNull(viewComponent.ViewContext.
ViewData
);
230
Assert.Empty(viewComponent.ViewContext.
ViewData
);
233
Assert.Same(viewComponent.ViewData, viewComponent.ViewContext.
ViewData
);
ViewExecutorTest.cs (1)
182
viewDataNull = v.
ViewData
== null;
RazorWebSite (2)
Services\BackSlashExpander.cs (1)
17
if (context.ActionContext is ViewContext viewContext && (string)viewContext.
ViewData
["back-slash"] == "true")
Services\TestBodyTagHelperComponent.cs (1)
40
ViewContext.
ViewData
["TestData"] = "NewValue";