1

升级到 Preview9。

但是当我尝试分离视图和模型时出现这个错误,有什么想法吗?

RAZORGENERATE:错误 RZ3008:标签助手无法定位标签名称“.ViewCustomerModel”,因为它包含“<”字符。

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);
        }
    }
}
4

1 回答 1

4

根据 MSFT https://github.com/aspnet/AspNetCore/issues/13881

您总是需要命名空间,因此需要将类包装在命名空间中。

于 2019-09-12T08:01:49.797 回答