63 writes to Model
HtmlGenerationWebSite (1)
Components\CheckViewData - LackModel.cs (1)
25
ViewData.
Model
= 78.9;
Microsoft.AspNetCore.Mvc.RazorPages (5)
Infrastructure\PageActionInvoker.cs (2)
142
_pageContext.ViewData.
Model
= _pageModel;
166
_pageContext.ViewData.
Model
= _page;
Infrastructure\PageResultExecutor.cs (1)
58
pageContext.ViewData.
Model
= result.Model;
PageBase.cs (1)
1187
Model
= model,
PageModel.cs (1)
1545
Model
= model,
Microsoft.AspNetCore.Mvc.RazorPages.Test (2)
PageTest.cs (2)
1722
viewData.
Model
= pageModel;
1747
viewData.
Model
= pageModel;
Microsoft.AspNetCore.Mvc.TagHelpers.Test (7)
PartialTagHelperTest.cs (6)
44
Model
= new object(),
91
viewContext.ViewData.
Model
= expectedModel;
326
viewContext.ViewData.
Model
= new object();
373
viewContext.ViewData.
Model
= new object();
460
viewContext.ViewData.
Model
= model;
499
viewContext.ViewData.
Model
= model;
TestableHtmlGenerator.cs (1)
81
Model
= model,
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
Controller.cs (2)
144
ViewData.
Model
= model;
197
ViewData.
Model
= model;
ViewDataDictionaryOfT.cs (1)
92
set => base.
Model
= value;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (45)
ControllerTest.cs (6)
95
controller.ViewData.
Model
= model;
182
controller.ViewData.
Model
= new object();
206
controller.ViewData.
Model
= model;
229
controller.ViewData.
Model
= model;
295
controller.ViewData.
Model
= new object();
421
controller.ViewData.
Model
= model;
PartialViewResultTest.cs (1)
33
Model
= customModel
Rendering\HtmlHelperPartialExtensionsTest.cs (2)
268
Model
= model
313
Model
= model
ViewComponentResultTest.cs (1)
42
Model
= customModel
ViewComponents\ViewComponentContextTest.cs (1)
105
viewComponentContext.ViewData.
Model
= model;
ViewComponentTests.cs (4)
88
viewComponent.ViewData.
Model
= model;
144
viewComponent.ViewData.
Model
= new object();
164
viewComponent.ViewData.
Model
= new object();
183
viewComponent.ViewData.
Model
= "Hello World!";
ViewDataDictionaryOfTModelTest.cs (12)
119
Model
= model,
140
Model
= model,
340
viewData4.
Model
= 26;
363
viewData4.
Model
= null;
385
var exception = Assert.Throws<InvalidOperationException>(() => viewData1.
Model
= 23);
388
exception = Assert.Throws<InvalidOperationException>(() => viewData2.
Model
= 24);
391
exception = Assert.Throws<InvalidOperationException>(() => viewData3.
Model
= 25);
395
exception = Assert.Throws<InvalidOperationException>(() => viewData4.
Model
= 26);
412
var exception = Assert.Throws<InvalidOperationException>(() => viewData1.
Model
= null);
415
exception = Assert.Throws<InvalidOperationException>(() => viewData2.
Model
= null);
418
exception = Assert.Throws<InvalidOperationException>(() => viewData3.
Model
= null);
422
exception = Assert.Throws<InvalidOperationException>(() => viewData4.
Model
= null);
ViewDataDictionaryTest.cs (14)
178
vdd.
Model
= model;
242
Model
= instance,
287
viewData.
Model
= model;
310
viewData.
Model
= model;
324
Model
= 3,
331
viewData.
Model
= 5;
357
viewData.
Model
= true;
382
viewData.
Model
= true;
416
Model
= 3,
423
viewData.
Model
= 3; // This is the same value, but it's in a different box.
443
Model
= model,
450
viewData.
Model
= model;
659
viewData.
Model
= model;
804
Model
= model
ViewDataOfTTest.cs (3)
18
Exception ex = Assert.Throws<InvalidOperationException>(() => viewData.
Model
= null);
30
Exception ex = Assert.Throws<InvalidOperationException>(() => viewData.
Model
= DateTime.UtcNow);
43
viewData.
Model
= value;
ViewResultTest.cs (1)
43
Model
= customModel
163 references to Model
Microsoft.AspNetCore.Mvc.Razor.Test (1)
RazorPageCreateModelExpressionTest.cs (1)
365
return ModelExpressionProvider.CreateModelExpression(ViewData, m => ViewContext.ViewData.
Model
);
Microsoft.AspNetCore.Mvc.RazorPages (1)
PageResult.cs (1)
23
public object Model => ViewData?.
Model
!;
Microsoft.AspNetCore.Mvc.RazorPages.Test (3)
Infrastructure\PageActionInvokerTest.cs (3)
201
Assert.Same(page, page.ViewContext.ViewData.
Model
);
257
Assert.Null(page.PageContext.ViewData.
Model
);
317
Assert.Same(pageModel, pageModel.ViewData.
Model
);
Microsoft.AspNetCore.Mvc.TagHelpers (1)
PartialTagHelper.cs (1)
177
return ViewContext.ViewData.
Model
;
Microsoft.AspNetCore.Mvc.TagHelpers.Test (3)
PartialTagHelperTest.cs (3)
332
var actual = Assert.IsType<PropertyModel>(v.ViewData.
Model
);
379
Assert.Null(v.ViewData.
Model
);
466
Assert.Same(model, v.ViewData.
Model
);
Microsoft.AspNetCore.Mvc.ViewFeatures (118)
Controller.cs (2)
119
return View(viewName, model: ViewData.
Model
);
172
return PartialView(viewName, model: ViewData.
Model
);
DefaultDisplayTemplates.cs (9)
21
if (htmlHelper.ViewData.
Model
!= null)
23
value = Convert.ToBoolean(htmlHelper.ViewData.
Model
, CultureInfo.InvariantCulture);
74
var model = htmlHelper.ViewData.
Model
;
150
if (htmlHelper.ViewData.TemplateInfo.FormattedModelValue == htmlHelper.ViewData.
Model
)
153
string.Format(CultureInfo.CurrentCulture, "{0:0.00}", htmlHelper.ViewData.
Model
);
161
var uriString = "mailto:" + ((htmlHelper.ViewData.
Model
== null) ?
163
htmlHelper.ViewData.
Model
.ToString());
279
var uriString = (htmlHelper.ViewData.
Model
== null) ? string.Empty : htmlHelper.ViewData.
Model
.ToString();
DefaultEditorTemplates.cs (7)
26
if (htmlHelper.ViewData.
Model
!= null)
28
value = Convert.ToBoolean(htmlHelper.ViewData.
Model
, CultureInfo.InvariantCulture);
56
var model = viewData.
Model
;
132
if (htmlHelper.ViewData.TemplateInfo.FormattedModelValue == htmlHelper.ViewData.
Model
)
135
string.Format(CultureInfo.CurrentCulture, "{0:0.00}", htmlHelper.ViewData.
Model
);
144
var model = viewData.
Model
;
422
var value = htmlHelper.ViewData.
Model
;
DefaultHtmlGenerator.cs (1)
1497
if (value == null || value == viewContext.ViewData.
Model
)
ExpressionMetadataProvider.cs (3)
157
viewDataInfo.Value == viewData.
Model
&&
204
var model = viewData.
Model
== null ? null : Convert.ToString(viewData.
Model
, CultureInfo.CurrentCulture);
HtmlHelperOfT.cs (1)
73
ViewData = new ViewDataDictionary<TModel>(viewContext.ViewData, viewContext.ViewData.
Model
);
PartialViewResult.cs (1)
35
public object? Model => ViewData?.
Model
;
Rendering\HtmlHelperInputExtensions.cs (24)
20
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
45
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
74
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
105
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
131
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
155
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
181
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
278
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
310
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
350
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
386
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
418
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
442
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
470
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
503
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>, or
536
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
563
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
595
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>, or
630
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
655
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
687
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
715
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
747
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
774
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
Rendering\HtmlHelperNameExtensions.cs (1)
14
/// current <see cref="ViewFeatures.ViewDataDictionary.
Model
"/> and the top-level view's model.
Rendering\HtmlHelperPartialExtensions.cs (8)
32
return htmlHelper.PartialAsync(partialViewName, htmlHelper.ViewData.
Model
, viewData: null);
55
return htmlHelper.PartialAsync(partialViewName, htmlHelper.ViewData.
Model
, viewData);
97
return Partial(htmlHelper, partialViewName, htmlHelper.ViewData.
Model
, viewData: null);
120
return Partial(htmlHelper, partialViewName, htmlHelper.ViewData.
Model
, viewData);
184
RenderPartial(htmlHelper, partialViewName, htmlHelper.ViewData.
Model
, viewData: null);
203
RenderPartial(htmlHelper, partialViewName, htmlHelper.ViewData.
Model
, viewData);
265
return htmlHelper.RenderPartialAsync(partialViewName, htmlHelper.ViewData.
Model
, viewData: null);
288
return htmlHelper.RenderPartialAsync(partialViewName, htmlHelper.ViewData.
Model
, viewData);
Rendering\HtmlHelperSelectExtensions.cs (11)
20
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
51
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
93
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
127
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
166
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
202
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
237
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
281
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
320
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
352
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
384
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
Rendering\HtmlHelperValueExtensions.cs (4)
18
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
38
/// the <paramref name="expression"/> evaluated against <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
64
/// the <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
84
/// the <see cref="ViewFeatures.ViewDataDictionary.
Model
"/>.
Rendering\IHtmlHelper.cs (9)
174
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
258
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
405
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>, or
449
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
473
/// <see cref="ViewDataDictionary.
Model
"/> and the top-level view's model.
523
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
616
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
641
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>, or
720
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
Rendering\IHtmlHelperOfT.cs (9)
30
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
119
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
192
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
241
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
269
/// <see cref="ViewDataDictionary.
Model
"/> and the top-level view's model.
309
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
341
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
368
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>, or
426
/// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.
Model
"/>.
ViewComponent.cs (1)
193
return View(viewName, ViewData.
Model
);
ViewComponentResult.cs (1)
41
public object? Model => ViewData?.
Model
;
ViewDataDictionary.cs (21)
50
/// For use when copying a <see cref="ViewDataDictionary"/> instance and the declared <see cref="
Model
"/>
55
/// This constructor should not be used in any context where <see cref="
Model
"/> may be set to a value
60
: this(source, source.
Model
, source._declaredModelType)
85
/// <see cref="Type"/> of <see cref="
Model
"/> values expected. Used to set <see cref="ModelMetadata"/>.
106
/// <see cref="Type"/> of <see cref="
Model
"/> values expected. Used to set <see cref="ModelMetadata"/>.
136
/// <see cref="Type"/> of <see cref="
Model
"/> values expected. Used to set <see cref="ModelMetadata"/>.
141
/// <see cref="
Model
"/> <see cref="Type"/> is known but <see cref="
Model
"/> should be copied from the existing
152
: this(source, model: source.
Model
, declaredModelType: declaredModelType)
162
/// <param name="model">Value for the <see cref="
Model
"/> property.</param>
164
/// <see cref="Type"/> of <see cref="
Model
"/> values expected. Used to set <see cref="ModelMetadata"/>.
169
/// <see cref="
Model
"/> <see cref="Type"/> and <see cref="
Model
"/> are known.
278
/// Gets the <see cref="ModelBinding.ModelMetadata"/> for an expression, the <see cref="
Model
"/> (if
294
/// Gets or sets the <see cref="ViewFeatures.ModelExplorer"/> for the <see cref="
Model
"/>.
357
/// <see cref="
Model
"/>.
379
/// <see cref="
Model
"/>.
426
/// <see cref="
Model
"/>.
434
/// Set <see cref="ModelExplorer"/> to ensure <see cref="
Model
"/> and <see cref="ModelExplorer.Model"/>
437
/// <param name="value">New <see cref="
Model
"/> value.</param>
460
else if (object.ReferenceEquals(value,
Model
))
ViewDataDictionaryOfT.cs (2)
91
get => (base.
Model
is null) ? default! : (TModel)base.
Model
;
ViewDataEvaluator.cs (2)
53
result = new ViewDataInfo(container: viewData, value: viewData.
Model
);
57
result = EvalComplexExpression(viewData.
Model
, expression);
ViewResult.cs (1)
35
public object? Model => ViewData?.
Model
;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (36)
ControllerTest.cs (11)
81
Assert.Null(actualViewResult.ViewData.
Model
);
105
Assert.Same(model, actualViewResult.ViewData.
Model
);
126
Assert.Null(actualViewResult.ViewData.
Model
);
148
Assert.Same(model, actualViewResult.ViewData.
Model
);
170
Assert.Same(model, actualViewResult.ViewData.
Model
);
192
Assert.Null(actualViewResult.ViewData.
Model
);
216
Assert.Same(model, actualViewResult.ViewData.
Model
);
239
Assert.Same(model, actualViewResult.ViewData.
Model
);
261
Assert.Same(model, actualViewResult.ViewData.
Model
);
283
Assert.Same(model, actualViewResult.ViewData.
Model
);
305
Assert.Null(actualViewResult.ViewData.
Model
);
ControllerUnitTestabilityTests.cs (2)
33
Assert.Same(model, viewResult.ViewData.
Model
);
55
Assert.Same(model, viewResult.ViewData.
Model
);
ViewComponentTests.cs (8)
78
Assert.Null(actualResult.ViewData.
Model
);
97
Assert.Same(model, actualResult.ViewData.
Model
);
115
Assert.Null(actualResult.ViewData.
Model
);
135
Assert.Same(model, actualResult.ViewData.
Model
);
155
Assert.Null(actualResult.ViewData.
Model
);
174
Assert.Null(actualResult.ViewData.
Model
);
193
Assert.Null(actualResult.ViewData.
Model
);
213
Assert.Same(model, actualResult.ViewData.
Model
);
ViewDataDictionaryOfTModelTest.cs (5)
63
Assert.Same(model, viewData2.
Model
);
102
Assert.Null(viewData2.
Model
);
126
Assert.Same(model, viewData.
Model
);
346
Assert.Equal(26, viewData4.
Model
);
369
Assert.Null(viewData4.
Model
);
ViewDataDictionaryTest.cs (10)
24
Assert.Null(viewData.
Model
);
42
Assert.Null(viewData.
Model
);
181
Assert.Same(model, vdd.
Model
);
205
Assert.Same(model, viewData.
Model
);
336
Assert.Equal(5, viewData.
Model
);
365
var model = Assert.IsType<bool>(viewData.
Model
);
389
Assert.Equal(viewData.
Model
, viewData.ModelExplorer.Model);
391
var model = Assert.IsType<bool>(viewData.
Model
);
428
Assert.Equal(3, viewData.
Model
);
454
Assert.Equal("Hello", viewData.
Model
);