Skip to content

Instantly share code, notes, and snippets.

@kidchenko
Created February 13, 2014 14:36
Show Gist options
  • Save kidchenko/8976105 to your computer and use it in GitHub Desktop.
Save kidchenko/8976105 to your computer and use it in GitHub Desktop.
Exemplo de relacionamentos com EF
//1 : 1
public class Produto
{
[Key]
public int Id {get;set;}
[ForeignKey("Categoria")]
public int CategoriaId {get;set;}
/*Outros atributos*/
public virtual Categoria Categoria {get; set;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment