Compound key mapping entity framework

0

Good afternoon,

How do I map compound key in my entities, in case the entity calls document and its PK is by property ID and WEBID, and it does FK with the User as I would in that case?

Document

    public class Documento : IAggregate
    {
        [Key]
        [Column(Order = 1)]
        public int Id { get; set; }
        [Key]
        [Column(Order = 2)]
        public int WebId{ get; set; }
        public int UsuarioId { get; set; }
        public string Situacao { get; set; }
        public string Numero { get; set; }
        public string Enviadoar { get; set; }
        public DateTime DataCriacao { get; set; }
        public virtual Usuario Usuario { get; set; }
}

User:

public class Usuario : IAggregate
    {
        [Key]
        public int UsuarioId { get; set; }
        public string CodigoUsuario { get; set; }
        [Key]
        public int WebId{ get; set; }

        public string Codigo { get; set; }

        public int NumeracaoAtual { get; set; }

        public DateTime Ano { get; set; }

        public virtual ICollection<Documento> Documentos { get; set; }
}
    
asked by anonymous 06.09.2018 / 00:48

0 answers