After creating a new Razor web forms app I scaffolded in an existing database:
Scaffold-DbContext "Server=<server>;Database=<db-name>;User ID=<username>;Password=<password>;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
And kept getting an error on the newly created entries:
A namespace cannot directly contain members such as fields
After ensuring I had added Entity Framework to the project using NuGet, I still got the error.
So it turns out I was using a namespace like this:
public partial class TblStories
But this isn't allowed - no hyphens. I had to rename my project to webapp3 and it was all fine.