-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support logging properties into user defined columns
- Loading branch information
1 parent
8b60f1d
commit 5323191
Showing
2 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @glennl122 - this seems like a good change to make, though it is possible the value type could be mismatched with the column definition.
Perhaps along with your proposed change, using
Convert.ChangeType()
on the value and perhaps some further validation, could cover it?Is this something you're interested in sending a PR for?
Cheers!
5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem I see with just doing the Convert.ChangeType is in the case that the type cannot be converted, we will fail to write anything to the database thereafter.
with the following method
This does indeed hide failures of conversion, but allows for other columns to have the data entered successfully.
The problem now would be having a SQL column of XML type since .NET abstracts this layer and the ColumnData type is a string. If some one were to try and add malformed XML, the logger will fail to write anything else to the database thereafter.
5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukexggwp yes, sounds like some careful checks/failure tolerance would be needed. For a start just enabling the common string/int/double/decimal/bool/datetime cases would perhaps be a nice improvement; falling back to string might also be sane in the case of a conversion problem? Interesting nonetheless (thanks for checking it out @glennl122).
5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nblumhardt I'll take a look into this, and perhaps have to add some sort of checks/failure tolerance to the DB commit portion. It'd be ideal if we are not forced to swallow the exception without a user knowing something went wrong. This part will take a bit more investigation. Thanks for your input
5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe to have fixed with my commit from last week, however I believe I did something to the Readme that claims it will be an incompatible merge? The actual source code fixes seem to work well, as I've been using them on a local project without issue
5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukexggwp when that happens, it generally means you need to
git merge
the target branch back into your PR branch, fix the conflicts, and then push the changes back to your PR. Not sure where to find good doco or I'd link it here, sorry - but should be googleable. HTH!5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nblumhardt Thanks! I had to figure out what to google before I could get the proper results on how to handle this with github. Sorry, I'm very new with contributing to a project via GitHub.
5323191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries - all the best with it.