using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
public static void Main()
using (var context = new BookStore())
Author author = new Author()
context.Authors.Add(author);
var authorData = context.Authors.ToList();
FiddleHelper.WriteTable(authorData);
public class BookStore : DbContext
public BookStore() : base(FiddleHelper.GetConnectionStringSqlServer())
protected override void OnModelCreating(DbModelBuilder modelBuilder)
public DbSet<Author> Authors { get; set; }
public int AuthorId { get; set; }
public string Name { get; set; }
public Address Address { get; set; }
public string City {get; set;}
public string Street { get; set; }
public string StateOrProvince { get; set; }
public string Country { get; set; }