modelBuilder.Configurations.Add(new ContentCategoryMap());
modelBuilder.Configurations.Add(new ContentCategoryMap());
private ICollection<Order> _orders;
public virtual Customer Customer { get; set; }
this.HasRequired(o => o.Customer) //fills the Customer on the Order object
.WithMany(c => c.Orders) //fills the Order collection on the Customer object
.HasForeignKey(o => o.CustomerId); //tells it what field you use for the relationship
public virtual ICollection<StateProvince> TaxExemptStates
{
get { return _taxExemptStates ?? (_taxExemptStates = new List<StateProvince>()); }
protected set { _taxExemptStates = value; }
}
this.HasMany(c => c.TaxExemptStates)
.WithMany() //I left it empty, I don't need an object on each State that has all the customers in it
.Map(m => m.ToTable("Customer_TaxExemptStates"));
modelBuilder.Configurations.Add(new Table1Map());
modelBuilder.Configurations.Add(new Table2Map());