❔ Questions on validating columns and types (updating a single column in a table via REST API)
I'm new to .NET and C#. I'm trying to implement a somewhat more difficult endpoint where the user provides a
ColumnName
and a Value
.
I've been able to implement checking if the ColumnName
is a valid column in the table, but I'm having difficulties converting the Value
to the type that the column (model property) expects, and if successful (its valid), proceeding.2 Replies
This is my column validator that appears to work
Maybe there's a better way to go about this?
Now that I think about it, would it probably be better to just make a DTO for this and set each updatable property to nullable and .NET should take care of it? Technically it gives the option to update multiple columns at once then, and it'll maybe be easier to signify which columns I don't want to be updated (like ID)
I am curious just for my learning purposes how I would implement what I mentioned first though
I know this is blatantly wrong for probably more than a few reasons, but that's what I was hacking on
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.