-
Notifications
You must be signed in to change notification settings - Fork 588
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
Trying to fix Issue #775 #808
base: main
Are you sure you want to change the base?
Conversation
trying to fix the Topic import bug
ruleFilter = new CorrelationFilter(propertyValue[CorrelationId] as string); | ||
ruleFilter = new CorrelationFilter() | ||
{ | ||
ContentType = !string.IsNullOrWhiteSpace(propertyValue[ContentType] as string) ? propertyValue[ContentType] as string : null, |
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.
Question: is it necessary to use ternary condition if it's either a value or a null? Could this (one example) be it?
ContentType = propertyValue[ContentType] as string,
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.
If use the code
ContentType = propertyValue[ContentType] as string
May cause the exception "Exception: The argument contentType is null or white space."
Because when the xml be like this <ContentType></ContentType>
, use propertyValue[ContentType] will get a empty string and I guess the construction function of CorrelationFilter can`t accept a empty string.
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.
Indeed. This is to avoid empty string. Thank you for elaboration. In that case, could you make it a local function and pass the property name? On the local function you could put XML documentation or a comment elaborating the rationale. Thank you.
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.
Ok, I will try to create a function to deal with it and add some comments.
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.
Added a extension method on Dictionary<string, object>.Think it`s cleaner.
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.
Let's sort out that summary. Otherwise, looks good and can be merged 👍
/// <summary> | ||
/// this exthension method is used to get the string value from the dictionary | ||
/// if the value is null or empty then it will return null | ||
/// </summary> | ||
/// <param name="propertyValue"></param> | ||
/// <param name="propertyName"></param> | ||
/// <returns></returns> |
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.
/// <summary> | |
/// this exthension method is used to get the string value from the dictionary | |
/// if the value is null or empty then it will return null | |
/// </summary> | |
/// <param name="propertyValue"></param> | |
/// <param name="propertyName"></param> | |
/// <returns></returns> | |
/// <summary> | |
/// Get the string value from the dictionary. Return null when the value is null or empty. | |
/// </summary> |
fix #775
Trying to fix the Topic import bug.
Added const string of correlation filter name.
Added CorrelationFilter initialization logic in CreateFilter function.