2

I'm trying to scaffold out a razor page set for my Ticket class and I'm getting an error when Entity Framework tries to create the database:

This shows the error next to my "Ticket" definition which includes a Key annotation above an "Id" property

My understanding is that if you have a property "Id" it will use it, and if you set the [Key] annotation it will specifically tell Entity Framework to use that property. I have both of those things, so what gives?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

5

Make your properties public .

public int Id { get; set; }