If you change the property PersonneId
to just Id
I think it will work for both types. Alternatively, decorate the PersonneId
property with the [Key]
attribute, which will indicate to EF what property you want to use as the table key:
public class Personne
{
[Key]
public int PersonneId { get; set; }
public string Nom { get; set;}
public string Prenom { get; set; }
}
You may also have to add this to the top of your code:
using System.ComponentModel.DataAnnotations;