Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Is there a way to scaffold a model that child classes inside?

$
0
0

I was following a blazor tutorial and there is this step where it can create a CRUD with just the model of a class. In the tutorial they only show it with a very simple class.I wanted to know if it is possible to do the same but with a class that as child class inside.

public class Match{    public int Id { get; set; }    public DateTime MatchTimestamp { get; set; }    public Player? Player1 { get; set; }    public Player? Player2 { get; set; }    public int Player1Score { get; set; }    public int Player2Score { get; set; }}

When I tried to scaffoled this class, it did not completly generate the html.Here an example in the Index.razor :

<QuickGrid Class="table" Items="context.Match"><PropertyColumn Property="match => match.MatchTimestamp" /><PropertyColumn Property="match => match.Player1Score" /><PropertyColumn Property="match => match.Player2Score" /><TemplateColumn Context="match"><a href="@($"matches/edit?id={match.Id}")">Edit</a> |<a href="@($"matches/details?id={match.Id}")">Details</a> |<a href="@($"matches/delete?id={match.Id}")">Delete</a></TemplateColumn></QuickGrid>

It did not generate the code to display Player1 or Player2.Is there a way to do it ?


Viewing all articles
Browse latest Browse all 4839

Trending Articles