Bonjour
Je teste "Code Fisrt" pour generer ma base de donnée mais j'ai un probleme pour crer une Cle primaire avec 2 ( ou plusieurs ) champs dans la cle.
Voici mom Entité

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  [Key, DataMember(Order = 1)]
        public int Bul_MatPerId { get; set; }
        [Key, DataMember(Order = 2)]
        public int Bul_RubBullId { get; set; }
 
        //[Key, DataMember(Order = 1)]
        //public int PlaylistId { get; set; }
        //[Key, DataMember(Order = 2)]
        //public int TrackId { get; set; }
        //[RelatedTo(ForeignKey = "PlaylistId")]
        //public Playlist Playlist { get; set; }
        //[RelatedTo(ForeignKey = "TrackId")]
        //public Track Track { get; set; }
 
        public int Bul_RubBull { get; set; }
        public Decimal Bul_ValBase { get; set; }
        public string Bul_TypBase { get; set; }
        public int Bul_DouBase { get; set; }
        public Decimal Bul_ValPlaf { get; set; }
        public string Bul_TypPlaf { get; set; }
        public int Bul_Douplaf { get; set; }
        public Decimal Bul_ValPlan { get; set; }
        public string Bul_TypPlan { get; set; }
        public int Bul_DouPlan { get; set; }
        public Decimal Bul_ValTaux { get; set; }
        public string Bul_TypTaux { get; set; }
        public int Bul_DouTaux { get; set; }
        public Decimal Bul_ValMont { get; set; }
        public string Bul_TypMont { get; set; }
        public int Bul_DouMont { get; set; }
        public Decimal Bul_ValCumul { get; set; }
Mais j'ai l'erreur suivante :
Unable to determine composite primary key ordering for type 'SXamBasePaie_DB.TpaBulletin'. Use the ColumnAttribute or the HasKey method to specify an order for composite primary keys.
Je suis conscient qu'il manque quelque chose , mais apres trests et recherches je n'arrrive pas .
Merci pour votre aide , car je pense que je vais adopter Code First