Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the right way to suppress EF warnings?

I would like to suppress these warnings but I could not figure out how to do it.

suppress

like image 741
Believe2014 Avatar asked Mar 30 '15 01:03

Believe2014


People also ask

How do you suppress warnings?

If we don't want to fix the warning, then we can suppress it with the @SuppressWarnings annotation. This annotation allows us to say which kinds of warnings to ignore. While warning types can vary by compiler vendor, the two most common are deprecation and unchecked.

How do you suppress warnings in VS code?

Choose Build, and go to the Errors and warnings subsection. In the Suppress warnings or Suppress specific warnings box, specify the error codes of the warnings that you want to suppress, separated by semicolons.

What is suppression State in Visual Studio?

It states if a warning had been suppressed by the #Disable Warning pragma. The state of a warning is either active or suppressed if it's enclosed in a pragma.


1 Answers

You are correct that these are warnings, not errors. The easiest way to supress the validation warnings from the compiler is to disable the Validate on Build property of the EF model. To do so, open your .edmx and select the background. Open the Properties window of Visual Studio and set Validate on Build to false. When you want to validate the model, just open the model again. There is also a right click context menu option on the model to Validate.

like image 60
Chris M. Avatar answered Oct 05 '22 01:10

Chris M.