Nakama
Nakama
CC#
Created by Nakama on 11/24/2024 in #help
GetFromJsonAsync and nested objects using FluentResults
Ah that explains a lot. My understanding was that fluent results were supposed to be used through all layers. I will create a dto for it instead.
6 replies
CC#
Created by Nakama on 6/3/2024 in #help
Extending a class while overwriting its properties
The calendar takes : Items IEnumerable<CalendarItem> The data to display in the Calendar. https://danheron.github.io/Heron.MudCalendar/api/calendar#properties
13 replies
CC#
Created by Nakama on 6/3/2024 in #help
Extending a class while overwriting its properties
Its not my class, its from the MudCalendar, a nugget package I am using
13 replies
CC#
Created by Nakama on 6/3/2024 in #help
Extending a class while overwriting its properties
Apologies I forgot to include the CalendarItem class. None of the properties are virtual or abstract.
public class CalendarItem
{
protected internal readonly string Id = Guid.NewGuid().ToString();

public DateTime Start { get; set; }

public DateTime? End { get; set; }

public bool AllDay { get; set; }

public string Text { get; set; } = string.Empty;


protected internal bool IsMultiDay
{
get
{
if (End.HasValue || !(Start.TimeOfDay > TimeSpan.FromHours(23.0)))
{
if (End.HasValue)
{
return End.Value.Date > Start.Date;
}

return false;
}

return true;
}
}
}
public class CalendarItem
{
protected internal readonly string Id = Guid.NewGuid().ToString();

public DateTime Start { get; set; }

public DateTime? End { get; set; }

public bool AllDay { get; set; }

public string Text { get; set; } = string.Empty;


protected internal bool IsMultiDay
{
get
{
if (End.HasValue || !(Start.TimeOfDay > TimeSpan.FromHours(23.0)))
{
if (End.HasValue)
{
return End.Value.Date > Start.Date;
}

return false;
}

return true;
}
}
}
13 replies
CC#
Created by Nakama on 6/3/2024 in #help
Extending a class while overwriting its properties
So I've removed the "new" keyword and the result unfortunately remains the same.
public new string Id { get; set; } = Guid.NewGuid().ToString();
[NotMapped]
public DateTime Start
{
get
{
return StartDate;
}
set
{
StartDate = value;
}
}
[NotMapped]
public DateTime? End
{
get
{
return StartDate + Duration;
}
set
{
value ??= StartDate + Duration;
Duration = value.Value - StartDate;
}
}
[NotMapped]
public bool AllDay { get; set; }
[NotMapped]
public string Text
{
get
{
return Name ?? string.Empty;
}
set { Name = value; }
}
public new string Id { get; set; } = Guid.NewGuid().ToString();
[NotMapped]
public DateTime Start
{
get
{
return StartDate;
}
set
{
StartDate = value;
}
}
[NotMapped]
public DateTime? End
{
get
{
return StartDate + Duration;
}
set
{
value ??= StartDate + Duration;
Duration = value.Value - StartDate;
}
}
[NotMapped]
public bool AllDay { get; set; }
[NotMapped]
public string Text
{
get
{
return Name ?? string.Empty;
}
set { Name = value; }
}
13 replies