Here is an example:
Consider these classes Item and ItemDetail. Item is the principal end and will share a table with ItemDetail:
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ItemDetail ItemDetail { get; set; }
}
public class ItemDetail
{
public int Id { get; set; }
public string Detail { get; set; }
}
Here is the fluent API code to do table splitting:
modelBuilder.Entity<Item>().ToTable("Items");
modelBuilder.Entity<ItemDetail>().ToTable("Items");
modelBuilder.Entity<Item>().HasRequired(i => i.ItemDetail).WithRequiredPrincipal();
And there you go, you'll have table splitting. Now you can lazy load your ItemDetail.
Jeff
This posting is provided "AS IS" with no warranties, and confers no rights.