Database first automatic class causes CA2214: Do not call overridable methods in constructors
The code you have posted is not throwing an error, it is just violating a code analysis rule and will work fine. The generated code is correct and by design to allow for lazy loading. You should suppress that warning for those files.