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

[Feature] Add #pragma to generated model class to hide warnings #33

Closed
evest opened this issue Mar 28, 2024 · 4 comments · Fixed by #35
Closed

[Feature] Add #pragma to generated model class to hide warnings #33

evest opened this issue Mar 28, 2024 · 4 comments · Fixed by #35
Labels
help wanted Extra attention is needed
Milestone

Comments

@evest
Copy link
Contributor

evest commented Mar 28, 2024

When running dotnet tool run ogschema ... to generate the data models class and include it in your project, it will generate a lot of compiler warnings like this:
Warning CS0108 : 'RegisterPage.MasterLanguage' hides inherited member 'Content.MasterLanguage'. Use the new keyword if hiding was intended.

Proper inheritance would be nice, but since these models are populated through JSON serializing, a simple:
#pragma warning disable CS0108, CS0114
at the top of the generated file will suffice.

My current project currently has 721 warnings.

I'm using JetBrains Rider, have not tested if Visual Studio shows these as warnings as well.

@evest evest added the help wanted Extra attention is needed label Mar 28, 2024
@ManhOptimizely
Copy link
Collaborator

@evest We can add this in the next release. thanks for report.

@ManhOptimizely ManhOptimizely added this to the Release 1.2.0 milestone Mar 29, 2024
@ManhOptimizely ManhOptimizely linked a pull request Mar 29, 2024 that will close this issue
@evest
Copy link
Contributor Author

evest commented Mar 29, 2024

Just a little FYI, in my code, I added the pragma once at the top. The change seems to add it multiple times. Might not mean anything.

@ManhOptimizely
Copy link
Collaborator

ManhOptimizely commented Apr 1, 2024

yeah. it works in for entire file. thank @evest, i will update the code

@ManhOptimizely
Copy link
Collaborator

Resolved in 1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants