Search code examples
blazorblazor-client-side

Getting error RAZORGENERATE : error RZ3008 creating Blazor ComponenBase


Upgraded to Preview9.

But getting this error when I try to separate View and Model, any ideas?

RAZORGENERATE : error RZ3008: Tag helpers cannot target tag name '.ViewCustomerModel' because it contains a '<' character.

public class ViewCustomerModel: ComponentBase
{
    [Inject]
    protected IDataService Data {get;set;}

    [Parameter] 
    public Guid CustomerId {get;set;}
    public Customer Customer {get;set;}

    protected override async Task OnInitializedAsync() 
    {
        await Load();
    }

    private async Task Cancel() => await Load();

    private async Task Load()
    {
        Customer = await Data.Load<Customer>(CustomerId);
    }

    private async Task Save(EditContext editContext)
    {
        if (editContext.Validate())
        {
            await Data.Save<Customer>(Customer);
        }
    }
}

Solution

  • As per MSFT https://github.com/aspnet/AspNetCore/issues/13881

    You require a namespace always, wrapping the class in a namespace is required.