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

[Question] Change property's access #227

Open
johnwc opened this issue Apr 4, 2023 · 4 comments
Open

[Question] Change property's access #227

johnwc opened this issue Apr 4, 2023 · 4 comments
Labels
question Further information is requested

Comments

@johnwc
Copy link

johnwc commented Apr 4, 2023

Is there a way to change a property of an entity to read-only during scaffolding?
Change public bool Field { get; set;} to public bool Field { get; private set;}

@johnwc johnwc added the question Further information is requested label Apr 4, 2023
@tonysneed
Copy link
Contributor

There are a number of ways. The easiest is to update the Properties.hbs template:

public {{property-type}} {{property-name}} { get; private set; }

@johnwc
Copy link
Author

johnwc commented Nov 28, 2024

But that would make every property read-only.

@tonysneed
Copy link
Contributor

tonysneed commented Nov 28, 2024 via email

@tonysneed tonysneed reopened this Nov 28, 2024
@johnwc
Copy link
Author

johnwc commented Nov 29, 2024

To be honest, I do not remember what I was trying to accomplish back then. I think I was trying to set certain properties of a table/entity to be read-only(private setter), as the property was going to be obsoleted for updating soon, but still needed to read it. This way it could be populated from database, but code could not update it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants