Skip to content
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

SectionDisplayDriver should override the HtmlPrefix with the TSectionName #15116

Closed
deanmarcussen opened this issue Jan 18, 2024 · 1 comment · Fixed by #15123
Closed

SectionDisplayDriver should override the HtmlPrefix with the TSectionName #15116

deanmarcussen opened this issue Jan 18, 2024 · 1 comment · Fixed by #15123
Milestone

Comments

@deanmarcussen
Copy link
Member

Currently the SectionDisplayDriver uses TSection for it's Entity property name :

protected virtual string PropertyName => typeof(TSection).Name;

However, it does not override the default Prefix value, which remains as per the base class Prefix = typeof(TModel).Name;

This creates ambiguity on the field names, where it is easily possible to have multiple keys of the same name, if classes used on IEntity have the same property names.

e.g.

public record PropertyA(bool Allow);
public record PropertyB(bool Allow);

PropertyA and PropertyB will be stored seperately in the properties dictionary correctly, but the views will create a form post with identical names.

@MikeAlhayek
Copy link
Member

Agreed. Specially if you want to inject multiple things into the shape like. I had to implement a wrong around for this on couple places already. Here is one

protected override void BuildPrefix(ISite model, string htmlFieldPrefix)

It may be also best to use both the TEntiry_TSecrion. Like if we are using site setting it should be ISite_SiteSettings. It is on my to do, but a PR from you would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants