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
Hello I have a DTO class that is retrieved from the backend:
public class TrainingDayDurationDto {
public DateOnly Date { get; set; }
public short DurationMinutes { get; set; }
public TrainingDayDurationDto(DateOnly date, short durationMinutes) {
Date = date;
DurationMinutes = durationMinutes;
}
}
then on the frontend I map this DTO to client specific object that can have frontend specific functionality/properties added, so I have:
[INotifyPropertyChanged]
public sealed partial class TrainingDayDuration : TrainingDayDurationDto {
[ObservableProperty] private DateOnly _date;
[ObservableProperty] private short _durationMinutes;
public TrainingDayDuration(DateOnly date, short durationMinutes) : base(date, durationMinutes) {
}
}
I expected then auto-generated properties for TrainingDayDuration will override those from parent object, but it doesnt seem to be the case. Because in debugger I can see 2 Date and 2 DurationMinutes properties like:
What is the right way to override it ?
Or is there a better way how to approach this whole thing ?
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
-
Hello I have a DTO class that is retrieved from the backend:
then on the frontend I map this DTO to client specific object that can have frontend specific functionality/properties added, so I have:
I expected then auto-generated properties for
TrainingDayDuration
will override those from parent object, but it doesnt seem to be the case. Because in debugger I can see 2 Date and 2 DurationMinutes properties like:What is the right way to override it ?
Or is there a better way how to approach this whole thing ?
Beta Was this translation helpful? Give feedback.
All reactions