-
Notifications
You must be signed in to change notification settings - Fork 0
Blazor supports DisplayName for models
#17
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
base: greptile_combined_20260121_qodo_grep_cursor_copilot_1_base_blazor_supports_displayname_for_models_pr84
Are you sure you want to change the base?
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Javier Calvarro Nelson <[email protected]>
Greptile SummaryThis PR adds a new
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant DisplayName
participant ExpressionMemberAccessor
participant MemberInfoCache
participant MemberInfo
participant Attributes
User->>DisplayName: Render with For expression
DisplayName->>DisplayName: SetParametersAsync()
alt Expression changed
DisplayName->>ExpressionMemberAccessor: GetDisplayName(expression)
ExpressionMemberAccessor->>MemberInfoCache: Check cache for expression
alt Cache miss
ExpressionMemberAccessor->>ExpressionMemberAccessor: Parse expression tree
ExpressionMemberAccessor->>MemberInfoCache: Store MemberInfo
end
ExpressionMemberAccessor->>MemberInfo: GetCustomAttribute<DisplayAttribute>()
alt DisplayAttribute exists
MemberInfo-->>ExpressionMemberAccessor: DisplayAttribute.GetName()
ExpressionMemberAccessor-->>DisplayName: Return display name
else Check DisplayNameAttribute
ExpressionMemberAccessor->>MemberInfo: GetCustomAttribute<DisplayNameAttribute>()
alt DisplayNameAttribute exists
MemberInfo-->>ExpressionMemberAccessor: DisplayNameAttribute.DisplayName
ExpressionMemberAccessor-->>DisplayName: Return display name
else Fallback
ExpressionMemberAccessor-->>DisplayName: Return member.Name
end
end
DisplayName->>DisplayName: Update _displayName
DisplayName->>DisplayName: BuildRenderTree()
end
DisplayName-->>User: Render display name text
|
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.
16 files reviewed, 3 comments
| internal static class ExpressionMemberAccessor | ||
| { | ||
| private static readonly ConcurrentDictionary<Expression, MemberInfo> _memberInfoCache = new(); | ||
| private static readonly ConcurrentDictionary<MemberInfo, string> _displayNameCache = new(); |
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.
logic: _displayNameCache is declared but never used. Either implement caching in GetDisplayName(MemberInfo) or remove this field.
| private static readonly ConcurrentDictionary<MemberInfo, string> _displayNameCache = new(); | |
| private static readonly ConcurrentDictionary<Expression, MemberInfo> _memberInfoCache = new(); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Components/Web/src/Forms/ExpressionMemberAccessor.cs
Line: 16:16
Comment:
**logic:** `_displayNameCache` is declared but never used. Either implement caching in `GetDisplayName(MemberInfo)` or remove this field.
```suggestion
private static readonly ConcurrentDictionary<Expression, MemberInfo> _memberInfoCache = new();
```
How can I resolve this? If you propose a fix, please make it concise.| { | ||
| _memberInfoCache.Clear(); |
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.
logic: ClearCache() only clears _memberInfoCache but not _displayNameCache. If _displayNameCache is meant to be used, it should also be cleared here for hot reload support.
| { | |
| _memberInfoCache.Clear(); | |
| private static void ClearCache() | |
| { | |
| _memberInfoCache.Clear(); | |
| _displayNameCache.Clear(); | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Components/Web/src/Forms/ExpressionMemberAccessor.cs
Line: 84:85
Comment:
**logic:** `ClearCache()` only clears `_memberInfoCache` but not `_displayNameCache`. If `_displayNameCache` is meant to be used, it should also be cleared here for hot reload support.
```suggestion
private static void ClearCache()
{
_memberInfoCache.Clear();
_displayNameCache.Clear();
}
```
How can I resolve this? If you propose a fix, please make it concise.| <div class="form-floating mb-3"> | ||
| <InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" /> | ||
| <label for="Input.Password" class="form-label">Password</label> | ||
| <ValidationMessage For="() => Input.Password" class="text-danger" /> | ||
| <InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" /> | ||
| <label for="Input.Password" class="form-label"> | ||
| <DisplayName For="() => Input.Password" /> | ||
| </label> | ||
| <ValidationMessage For="() => Input.Password" class="text-danger" /> |
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.
style: Inconsistent indentation - this block should align with the one above at line 26-31.
| <div class="form-floating mb-3"> | |
| <InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" /> | |
| <label for="Input.Password" class="form-label">Password</label> | |
| <ValidationMessage For="() => Input.Password" class="text-danger" /> | |
| <InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" /> | |
| <label for="Input.Password" class="form-label"> | |
| <DisplayName For="() => Input.Password" /> | |
| </label> | |
| <ValidationMessage For="() => Input.Password" class="text-danger" /> | |
| <div class="form-floating mb-3"> | |
| <InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" /> | |
| <label for="Input.Password" class="form-label"> | |
| <DisplayName For="() => Input.Password" /> | |
| </label> | |
| <ValidationMessage For="() => Input.Password" class="text-danger" /> | |
| </div> |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Login.razor
Line: 33:38
Comment:
**style:** Inconsistent indentation - this block should align with the one above at line 26-31.
```suggestion
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" />
<label for="Input.Password" class="form-label">
<DisplayName For="() => Input.Password" />
</label>
<ValidationMessage For="() => Input.Password" class="text-danger" />
</div>
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Benchmark PR from qodo-benchmark#84