41 instantiations of FieldIdentifier
Microsoft.AspNetCore.Components.Forms (3)
EditContext.cs (1)
57
=> new
FieldIdentifier
(Model, fieldName);
EditContextDataAnnotationsExtensions.cs (1)
136
_messages.Add(new
FieldIdentifier
(_editContext.Model, fieldName: string.Empty), validationResult.ErrorMessage!);
FieldIdentifier.cs (1)
36
return new
FieldIdentifier
(model, fieldName);
Microsoft.AspNetCore.Components.Forms.Tests (36)
EditContextDataAnnotationsExtensionsTest.cs (2)
114
var requiredStringIdentifier = new
FieldIdentifier
(model, nameof(TestModel.RequiredString));
115
var intFrom1To100Identifier = new
FieldIdentifier
(model, nameof(TestModel.IntFrom1To100));
EditContextTest.cs (9)
50
var fieldOnOtherModel = new
FieldIdentifier
(new object(), "field on other model");
109
var field1 = new
FieldIdentifier
(new object(), "fieldname"); // Shows it can be on a different model
132
var field = new
FieldIdentifier
(new object(), "field");
133
var fieldWithNoState = new
FieldIdentifier
(new object(), "field with no state");
136
store1.Add(new
FieldIdentifier
(new object(), "otherfield"), "Message for other field that should not appear in results");
162
var field1 = new
FieldIdentifier
(new object(), "field1");
163
var field2 = new
FieldIdentifier
(new object(), "field2");
203
new
FieldIdentifier
(new object(), "some field"),
224
new
FieldIdentifier
(new object(), "some field"),
FieldIdentifierTest.cs (17)
15
var ex = Assert.Throws<ArgumentNullException>(() => new
FieldIdentifier
(null, "somefield"));
22
var ex = Assert.Throws<ArgumentException>(() => new
FieldIdentifier
(DateTime.Now, "somefield"));
30
var ex = Assert.Throws<ArgumentNullException>(() => new
FieldIdentifier
(new object(), null));
37
var fieldIdentifier = new
FieldIdentifier
(new object(), string.Empty);
46
var fieldIdentifier = new
FieldIdentifier
(model, "someField");
57
var fieldIdentifier1 = new
FieldIdentifier
(new object(), "field");
58
var fieldIdentifier2 = new
FieldIdentifier
(new object(), "field");
70
var fieldIdentifier1 = new
FieldIdentifier
(model, "field1");
71
var fieldIdentifier2 = new
FieldIdentifier
(model, "field2");
83
var fieldIdentifier1 = new
FieldIdentifier
(model, fieldName: string.Empty);
84
var fieldIdentifier2 = new
FieldIdentifier
(model, fieldName: string.Empty);
96
var fieldIdentifier1 = new
FieldIdentifier
(model, "field");
97
var fieldIdentifier2 = new
FieldIdentifier
(model, "field");
109
var fieldIdentifier1 = new
FieldIdentifier
(model, nameof(EquatableModel.Property));
111
var fieldIdentifier2 = new
FieldIdentifier
(model, nameof(EquatableModel.Property));
123
var fieldIdentifierLower = new
FieldIdentifier
(model, "field");
124
var fieldIdentifierPascal = new
FieldIdentifier
(model, "Field");
ValidationMessageStoreTest.cs (8)
26
var field1 = new
FieldIdentifier
(new object(), "field1");
27
var field2 = new
FieldIdentifier
(new object(), "field2");
28
var field3 = new
FieldIdentifier
(new object(), "field3");
46
var field1 = new
FieldIdentifier
(new object(), "field1");
61
var field1 = new
FieldIdentifier
(new object(), "field1");
62
var field2 = new
FieldIdentifier
(new object(), "field2");
80
var field1 = new
FieldIdentifier
(new object(), "field1");
81
var field2 = new
FieldIdentifier
(new object(), "field2");
Microsoft.AspNetCore.Components.Web (2)
Forms\Mapping\EditContextFormMappingExtensions.cs (1)
67
fieldIdentifier = new
FieldIdentifier
(owner ?? _editContext.Model, key);
Forms\ValidationSummary.cs (1)
66
CurrentEditContext.GetValidationMessages(new
FieldIdentifier
(Model, string.Empty));
149 references to FieldIdentifier
BasicTestApp (1)
FormsTest\CustomFieldCssClassProvider.cs (1)
13
public override string GetFieldCssClass(EditContext editContext, in
FieldIdentifier
fieldIdentifier)
Microsoft.AspNetCore.Components.Forms (46)
EditContext.cs (15)
20
private readonly Dictionary<
FieldIdentifier
, FieldState> _fieldStates = new Dictionary<
FieldIdentifier
, FieldState>();
51
/// Supplies a <see cref="
FieldIdentifier
"/> corresponding to a specified field name
55
/// <returns>A <see cref="
FieldIdentifier
"/> corresponding to a specified field name on this <see cref="EditContext"/>'s <see cref="Model"/>.</returns>
56
public
FieldIdentifier
Field(string fieldName)
78
public void NotifyFieldChanged(in
FieldIdentifier
fieldIdentifier)
96
public void MarkAsUnmodified(in
FieldIdentifier
fieldIdentifier)
160
public IEnumerable<string> GetValidationMessages(
FieldIdentifier
fieldIdentifier)
179
=> GetValidationMessages(
FieldIdentifier
.Create(accessor));
185
public bool IsModified(in
FieldIdentifier
fieldIdentifier)
196
=> IsModified(
FieldIdentifier
.Create(accessor));
202
public bool IsValid(in
FieldIdentifier
fieldIdentifier)
211
=> IsValid(
FieldIdentifier
.Create(accessor));
223
internal FieldState? GetFieldState(in
FieldIdentifier
fieldIdentifier)
229
internal FieldState GetOrAddFieldState(in
FieldIdentifier
fieldIdentifier)
EditContextDataAnnotationsExtensions.cs (2)
88
var
fieldIdentifier = eventArgs.FieldIdentifier;
157
private static bool TryGetValidatableProperty(in
FieldIdentifier
fieldIdentifier, [NotNullWhen(true)] out PropertyInfo? propertyInfo)
FieldChangedEventArgs.cs (3)
14
/// <param name="fieldIdentifier">The <see cref="Forms.
FieldIdentifier
"/></param>
15
public FieldChangedEventArgs(in
FieldIdentifier
fieldIdentifier)
23
public
FieldIdentifier
FieldIdentifier { get; }
FieldIdentifier.cs (8)
17
public readonly struct FieldIdentifier : IEquatable<
FieldIdentifier
>
27
/// Initializes a new instance of the <see cref="
FieldIdentifier
"/> structure.
31
public static
FieldIdentifier
Create<TField>(Expression<Func<TField>> accessor)
40
/// Initializes a new instance of the <see cref="
FieldIdentifier
"/> structure.
85
=> obj is
FieldIdentifier
otherIdentifier
89
public bool Equals(
FieldIdentifier
otherIdentifier)
137
throw new ArgumentException($"The provided expression contains a {accessorBody.GetType().Name} which is not supported. {nameof(
FieldIdentifier
)} only supports simple member accessors (fields, properties) of an object.");
149
throw new ArgumentException($"The provided expression contains a {accessorBody.GetType().Name} which is not supported. {nameof(
FieldIdentifier
)} only supports simple member accessors (fields, properties) of an object.");
FieldState.cs (2)
8
private readonly
FieldIdentifier
_fieldIdentifier;
16
public FieldState(
FieldIdentifier
fieldIdentifier)
ValidationMessageStore.cs (16)
14
private readonly Dictionary<
FieldIdentifier
, List<string>> _messages = new Dictionary<
FieldIdentifier
, List<string>>();
30
public void Add(in
FieldIdentifier
fieldIdentifier, string message)
39
=> Add(
FieldIdentifier
.Create(accessor), message);
46
public void Add(in
FieldIdentifier
fieldIdentifier, IEnumerable<string> messages)
55
=> Add(
FieldIdentifier
.Create(accessor), messages);
60
/// To get the validation messages across all validation message stores, use <see cref="EditContext.GetValidationMessages(
FieldIdentifier
)"/> instead
64
public IEnumerable<string> this[
FieldIdentifier
fieldIdentifier]
70
/// To get the validation messages across all validation message stores, use <see cref="EditContext.GetValidationMessages(
FieldIdentifier
)"/> instead
75
=> this[
FieldIdentifier
.Create(accessor)];
82
foreach (
var
fieldIdentifier in _messages.Keys)
95
=> Clear(
FieldIdentifier
.Create(accessor));
101
public void Clear(in
FieldIdentifier
fieldIdentifier)
107
private List<string> GetOrCreateMessagesListForField(in
FieldIdentifier
fieldIdentifier)
119
private void AssociateWithField(in
FieldIdentifier
fieldIdentifier)
122
private void DissociateFromField(in
FieldIdentifier
fieldIdentifier)
Microsoft.AspNetCore.Components.Forms.Tests (65)
EditContextDataAnnotationsExtensionsTest.cs (2)
114
var
requiredStringIdentifier = new FieldIdentifier(model, nameof(TestModel.RequiredString));
115
var
intFrom1To100Identifier = new FieldIdentifier(model, nameof(TestModel.IntFrom1To100));
EditContextTest.cs (16)
29
var
fieldIdentifier = editContext.Field("testFieldName");
48
var
fieldOnThisModel1 = editContext.Field("field1");
49
var
fieldOnThisModel2 = editContext.Field("field2");
50
var
fieldOnOtherModel = new FieldIdentifier(new object(), "field on other model");
68
var
fieldThatWasModified = editContext.Field("field1");
69
var
fieldThatRemainsModified = editContext.Field("field2");
70
var
fieldThatWasNeverModified = editContext.Field("field that was never modified");
90
var
field1 = editContext.Field("field1");
91
var
field2 = editContext.Field("field2");
109
var
field1 = new FieldIdentifier(new object(), "fieldname"); // Shows it can be on a different model
132
var
field = new FieldIdentifier(new object(), "field");
133
var
fieldWithNoState = new FieldIdentifier(new object(), "field with no state");
162
var
field1 = new FieldIdentifier(new object(), "field1");
163
var
field2 = new FieldIdentifier(new object(), "field2");
242
var
fieldOnThisModel1 = editContext.Field("field1");
243
var
fieldOnThisModel2 = editContext.Field("field2");
FieldIdentifierTest.cs (39)
37
var
fieldIdentifier = new FieldIdentifier(new object(), string.Empty);
46
var
fieldIdentifier = new FieldIdentifier(model, "someField");
57
var
fieldIdentifier1 = new FieldIdentifier(new object(), "field");
58
var
fieldIdentifier2 = new FieldIdentifier(new object(), "field");
70
var
fieldIdentifier1 = new FieldIdentifier(model, "field1");
71
var
fieldIdentifier2 = new FieldIdentifier(model, "field2");
83
var
fieldIdentifier1 = new FieldIdentifier(model, fieldName: string.Empty);
84
var
fieldIdentifier2 = new FieldIdentifier(model, fieldName: string.Empty);
96
var
fieldIdentifier1 = new FieldIdentifier(model, "field");
97
var
fieldIdentifier2 = new FieldIdentifier(model, "field");
109
var
fieldIdentifier1 = new FieldIdentifier(model, nameof(EquatableModel.Property));
111
var
fieldIdentifier2 = new FieldIdentifier(model, nameof(EquatableModel.Property));
123
var
fieldIdentifierLower = new FieldIdentifier(model, "field");
124
var
fieldIdentifierPascal = new FieldIdentifier(model, "Field");
137
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
153
var value =
FieldIdentifier
.GetModelFromMemberAccess((MemberExpression)body.Expression, cache);
165
FieldIdentifier
.Create(() => new TestModel()));
166
Assert.Equal($"The provided expression contains a NewExpression which is not supported. {nameof(
FieldIdentifier
)} only supports simple member accessors (fields, properties) of an object.", ex.Message);
173
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringField);
185
var
fieldIdentifier =
FieldIdentifier
.Create(accessor);
193
var
fieldIdentifier =
FieldIdentifier
.Create(() => StringPropertyOnThisClass);
202
var
fieldIdentifier =
FieldIdentifier
.Create(() => parentModel.Child.StringField);
211
var
fieldIdentifier =
FieldIdentifier
.Create(() => models[1].StringField);
220
var
fieldIdentifier =
FieldIdentifier
.Create(() => ((TestModel)(object)model).StringField);
228
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.Field);
241
var
fieldIdentifier =
FieldIdentifier
.Create(() => Model2.Property);
253
var
fieldIdentifier =
FieldIdentifier
.Create(() => model3.Value);
261
var
fieldIdentifier =
FieldIdentifier
.Create(() => @ÖvrigAnställning.Ort);
ValidationMessageStoreTest.cs (8)
26
var
field1 = new FieldIdentifier(new object(), "field1");
27
var
field2 = new FieldIdentifier(new object(), "field2");
28
var
field3 = new FieldIdentifier(new object(), "field3");
46
var
field1 = new FieldIdentifier(new object(), "field1");
61
var
field1 = new FieldIdentifier(new object(), "field1");
62
var
field2 = new FieldIdentifier(new object(), "field2");
80
var
field1 = new FieldIdentifier(new object(), "field1");
81
var
field2 = new FieldIdentifier(new object(), "field2");
Microsoft.AspNetCore.Components.Web (9)
Forms\EditContextFieldClassExtensions.cs (2)
24
=> FieldCssClass(editContext,
FieldIdentifier
.Create(accessor));
32
public static string FieldCssClass(this EditContext editContext, in
FieldIdentifier
fieldIdentifier)
Forms\FieldCssClassProvider.cs (2)
20
/// <param name="fieldIdentifier">The <see cref="
FieldIdentifier
"/>.</param>
22
public virtual string GetFieldCssClass(EditContext editContext, in
FieldIdentifier
fieldIdentifier)
Forms\InputBase.cs (2)
72
protected internal
FieldIdentifier
FieldIdentifier { get; set; }
239
FieldIdentifier =
FieldIdentifier
.Create(ValueExpression);
Forms\Mapping\EditContextFormMappingExtensions.cs (1)
66
FieldIdentifier
fieldIdentifier;
Forms\ValidationMessage.cs (2)
17
private
FieldIdentifier
_fieldIdentifier;
56
_fieldIdentifier =
FieldIdentifier
.Create(For);
Microsoft.AspNetCore.Components.Web.Tests (28)
Forms\InputBaseTest.cs (22)
91
Assert.Equal(
FieldIdentifier
.Create(() => model.StringProperty), inputComponent.FieldIdentifier);
209
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
247
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
287
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.DateProperty);
317
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.DateProperty);
350
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.DateProperty);
374
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
410
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
439
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
474
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
503
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.StringProperty);
558
public new
FieldIdentifier
FieldIdentifier => base.FieldIdentifier;
Forms\InputDateTest.cs (2)
22
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.DateProperty);
Forms\InputNumberTest.cs (2)
37
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.SomeNumber);
Forms\InputSelectTest.cs (2)
180
var
fieldIdentifier =
FieldIdentifier
.Create(() => model.NotNullableInt);