xiaolizi007
2/21/2017 - 2:55 AM

ExecuteSqlCommand

ExecuteSqlCommand #ado.net

protected override void Seed(Context context)
  {    
  context.Database.ExecuteSqlCommand("ALTER TABLE Users ADD CONSTRAINT uc_Billing UNIQUE(BillingAddressId)");     
  context.Database.ExecuteSqlCommand("ALTER TABLE Users ADD CONSTRAINT uc_Delivery UNIQUE(DeliveryAddressId)"); 
  }