-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setting to ignore default value checker #121
Comments
Can someone help me understand what is referred to as 'IT' in '...if IT doesn't have...'? Can someone help me understand the meaning of '...the default value' in this context? |
@JimKay1941 If you're filling an object and the property doesn't have a default value (0 for numerics, null for objects, ...) then GenFu will ignore the property and not fill it. That's what you were seeing in your other issue (#126). The idea here is that we could do
And GenFu would fill the property regardless of it already had a value. Disclaimer syntax above not the final syntax |
Don't you find it jarring to have to combine 'new List<string>' and 'ForceFillEvenIfAlreadyFilled = true' in the very same statement? Perhaps GenFu needs an additional boolean property: 'ForceFillEvenIfEmpty' wouldn't you say? Though, upon reflection, I don't really understand how/why 'ignore' would EVER be acceptable behavior. When a service routine does NOT do what was requested, it really SHOULD provide some indication. The notion of 'fail silently' annoys me no end. |
Keep in mind that we want to maintain backwards compatibility so this new behaviour cannot be the default. I'd argue that GenFu is doing what is expected, it is filling in missing data. Something like
Is a reasonable application of GenFu. I'd also draw your attention to the disclaimer above that this is not a final syntax. I'm certainly willing to entertain other options so please feel free to expand upon your ForceFillEvenIfEmpty idea. |
As a check against developer errors, I may want to differentiate between FillEvenIfAlreadyFilled and FillEvenIfEmpty. To me, these are entirely different situations. (Right now, I'm trying to test the latest version that MisterJames submitted as a Pull.) |
FillEvenIfEmpty is the default behaviour now, we'll fill anything that looks like a collection unless it has things in it already. |
I have tested this version by cloning it into a Git Repository. This version is working now in the same way the Alice version was working. Thank you for your assistance. Can you estimate when this update will be available as a Nuget Package? |
Fixes MisterJames#121 Add a setting to ignore the default value checker * Add a new boolean property `IgnoreDefaultValueChecker` to the `GenFu` class in `src/GenFu/GenFu.cs`. * Modify the `New` method in the `GenFu` class to check the `IgnoreDefaultValueChecker` property before using the `DefaultValueChecker`. * Add a method to set the `IgnoreDefaultValueChecker` property in the `GenFuConfigurator` class in `src/GenFu/GenFuConfigurator.cs`. * Add tests in `tests/GenFu.Tests/GenFuTests.cs` to verify the new behavior of ignoring the default value checker. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/MisterJames/GenFu/issues/121?shareId=XXXX-XXXX-XXXX-XXXX).
I see that GenFu will not write to a property if it doesn't have the default value. I think there should be a setting so we can turn this off if needed.
The text was updated successfully, but these errors were encountered: