You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we have an object with (say) a string property, then in a Blazor EditForm we can do the following...
<InputText @bind-Value="MyModel.Name" />
However, if name is a value object, then this doesn't work, as (presumably) the InputText component assumes that the property being bound has a public getter and setter. As value objects don't have those, it looks like we can use them for any properties that we want to edit in a Blazor form.
Is there any way around this? I know I can create a model for the form which uses the underlying primitive data type, but apart from adding yet another representation of the entity (on top of the database model and the DTO), it kind of removes the basic advantage of VOs in the first place.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
If we have an object with (say) a
string
property, then in a BlazorEditForm
we can do the following...However, if
name
is a value object, then this doesn't work, as (presumably) theInputText
component assumes that the property being bound has a public getter and setter. As value objects don't have those, it looks like we can use them for any properties that we want to edit in a Blazor form.Is there any way around this? I know I can create a model for the form which uses the underlying primitive data type, but apart from adding yet another representation of the entity (on top of the database model and the DTO), it kind of removes the basic advantage of VOs in the first place.
Anyone able to help here? Thanks
Beta Was this translation helpful? Give feedback.
All reactions