Issue binding data to model? #85
-
I'm trying to follow the guide below to bind the CSV data directly to my model, and while it's generating the expected number of items in the return value, no actual data is being bound. What am I missing? My code snippet:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Can you share the definition of the |
Beta Was this translation helpful? Give feedback.
-
Change the fields to properties and it should work.
The databinder needs some work, so I'm taking notes about some potential improvements. |
Beta Was this translation helpful? Give feedback.
-
Had this error thrown when I did that on this line: var binder = DataBinder.Create(csv); Unhandled exception. Sylvan.Data.DataBinderException: Exception of type 'Sylvan.Data.DataBinderException' was thrown. This is my code ( I might be fundamentally missing something here that's not standing out)
|
Beta Was this translation helpful? Give feedback.
-
It looks like the issue is that your csv file doesn't have headers (
|
Beta Was this translation helpful? Give feedback.
It looks like the issue is that your csv file doesn't have headers (
HasHeaders = false
). The binder doesn't know what to do with the data, since it isn't explicitly labeled. You can fix this by defining the column schema explicitly.