core-admin
core-admin copied to clipboard
(floats) InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'System.Single', but this ViewDataDictionary instance requires a model item of type 'System.String'.
Any Entity property of type float causes the exception below
InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'System.Single', but this ViewDataDictionary instance requires a model item of type 'System.String'.
Steps to reproduce:
- Add the property below to DotNetEd.CoreAdmin.DemoApp.Models.TestEntity public float TaxRate { get; set; }
- Edit the TestEntity from the UI and throws an exception
The implemented fix was to decorate the float property with [DataType(DataType.Text)] and the backend will catch any validation issues.
[DataType(DataType.Text)] public float TaxRate { get; set; }