I used the EF Designer from Database to create an Entity Data Model. I try this code:
public class BillboardContext : DbContext { public DbSet<Billboard> Billboards { get; set; } }
public class BillboardData { public void GetData()
{
using (var context = new BillboardContext())
{
var bbb = context.Billboards.SqlQuery("SELECT * FROM coherent.billboard").ToList();
...
}
}
The SqlQuery statement gives the "EntityType 'Billboard' has no key" error.
Using the designer in VS 2017 to look at the Billboard entity, it correctly shows that there is a field that is an identity column and that is an "Entity Key".
I have seen suggestions that you should add to the C# code for the table a [Key] descriptor, but that's generated code.