-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
MemberAccessStrategy.IgnoreCase doesn't work #615
Comments
@sebastienros Is it "by design", or it is a bug? Please advise. |
Check this fluid/Fluid.Tests/TemplateTests.cs Lines 870 to 890 in f62d8a5
|
Can you add a test case that show it works if you type the correct case |
@sebastienros Brackets somehow missed from the template here, of course there are double-brackets in the template. Sorry for confusion. The full version of the template looks like:
It works when the case matches, and doesn't work if not , ignoring IgnoreCase setting. Also, could it be the reason of usage Dictionary<string, object> instead of object? @hishamco on a provided sample you register the type, maybe this is the reason - I don't know. But for my case, anonymous types are essential. P.S. To confirm the issue before posting it here, I created 2 identical test cases with small difference in Letter-case. And as I wrote above 1 - pass OK (when case matches) , 2 - doesn't (VehicleBrand -> VehiclEbrand) |
For your convinience:
|
Thanks for confirming. I think it's a bug on the custom properties, not the ones coming from the model which are using the membership accessors. Can you try to pass a dictionary that is initialized with a StringComparison.OrdinalIgnoreCase? |
UPDATE. Then, I tried all the tests with adding the following line into
After adding that line, test with objects (anonymous and typed) passed respecting the IgnoreCase setting option, but test with Dictionary<string, object> with Keys in incorrect case still fail. |
@sebastienros Sorry, what do you mean? Could you please elaborate. Actually, I would be happy to pass an anonymous object instead of Dictionary, but for now, I can not. I can try to verify templates and data-models manually. But as you know, "manually" is the word I would like to exclude :-) Looking forward to an updated version. |
var data = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
{
{"VehicleBrand", "Toyota"},
{"LicensePlate", "ab123cd11"}
}; |
Oh, a test with Unfortunately, in a real code, Dictionary is coming from JSON a result of deserialization. For my case, I think I can tune-up a deserializer in this part. So it is a good bypass option. Happy holidays! |
FYI there is a PR that should solve it #681 |
Fluid.Core version 2.5.0
Ignore Case doesn't work, repro-code below. Is there any option to make it case-insensitive?
The text was updated successfully, but these errors were encountered: