RegistryRepository GetValue not working


Author
Message
Andria Jensen
Andria Jensen
StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Ok, that makes total sense.  We can just use a string or an int value and convert to bool.  Thanks for the help.
StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Aha, I stepped through the sample and figured it out.  The ReadValue() method of the registry repository isn't meant to be called externally; it's supposed to be private, not public.  If the ReadValue() method cannot retrieve the value, the ByRef parameter is set to Nothing, and when you set a value type to Nothing, it defaults to the "default" value for that value type.  All of the ReadXX() methods like ReadString(), ReadInt32(), etc. all call the read value internally.  They test the return value of the ReadValue() and return the default value if passed directly.  The reason there is no read Boolean is that there is no Boolean data type in the Windows registry.  You have to use an integer and test for > 0 or use a string and parse the "true" or "false" from the string.  I'll add an enhancement request to add a ReadBoolean that stores values in a WORD registry type and uses 0 for False and 1 for True.  In the meantime, you can add your own ReadBoolean or just test on the return value of the ReadValue() method; it will tell you whether the value was successfully retrieved from the database.
Andria Jensen
Andria Jensen
StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Okay, here's a little sample.  When you enter in a default value it should show up as that value when you click 'Get Value' since the value should be missing from the registry.  It works as it should for Int and String values.  But for the Boolean, it always returns False whether it is checked or not.  Maybe I'm doing something wrong in the code, in which case you could correct me.  Please let me know what you think.  Thanks for the help.
Attachments
RepositoryTest.zip (78 views, 720.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I cannot reproduce this behavior you are describing and we use it everywhere.  Can you provide a sample that will replicate the behavior?
Andria Jensen
Andria Jensen
StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I have been using the RegistryRepository for a while now, and today came across an interesting bug.  I'm not sure if it just hasn't presented itself until now or if it was introduced recently.  When I do a GetValue and send in a DefaultValue it is not returning the DefaultValue if the value is missing from the registry.  It is always returning a False if the value is not there, and in the case of this bug it should be returning a True.  Any idea what is going on here?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search