Skip to content

Instantly share code, notes, and snippets.

@scottsauber
Created November 16, 2017 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottsauber/adacdfd388b019b29eca62ed37c7bce4 to your computer and use it in GitHub Desktop.
Save scottsauber/adacdfd388b019b29eca62ed37c7bce4 to your computer and use it in GitHub Desktop.
public class PostConfig : IEntityTypeConfiguration<Post>
{
public void Configure(EntityTypeBuilder<Post> builder)
{
builder.HasOne(p => p.Blog)
.WithOne(b => b.Posts)
.HasForeignKey(p => p.BlogId)
.HasConstraintName("ForeignKey_Post_Blog");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment