have this razor generic component TModel
with parameters of Expression<Func<TModel,object>>[]
parameter
now when the parent component of the previous one gives TModel
type WorkOrder
the Expression<Func<TModel,object>>
remains TModel
and therefore I can't pass WorkOrder
expressions!
Code
DataGridComponent.razor.cs
public partial class DataGridComponent<TModel> : ComponentBase , IDisposable
where TModel : DbModel
{
[Parameter]
public Expression<Func<TModel, object>>[] Properties { get; set; }
}
SomeViewModel.razor
<div>
<DataGridComponent TModel="WorkOrder" Orderable="true" Indexable="true"
Properties="new Expression<Func<WorkOrder, object>>[] { <--------- Syntax Error
a=>a.Location.LocationType,
a=>a.MainService
}"></DataGridComponent>
</div>
and it shows the conversion regular syntax error
Cannot covert Expression.... WorkOrder to ... TModel
Further technical details
- ASP.NET Core version : 3.1
- The IDE (VS 16.4 prev. 4)