Posted on: 11/23/2012 1:32:30 AM | Views : 394

Hi there,
I have simple DBcontext class called OdeToFoodDb:
public class OdeToFoodDb: DbContext { public DbSet<Restaurant> Restaurants { get; set; } public DbSet<Review> Reviews { get; set; } protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder) { modelBuilder.Entity<Restaurant>() .HasMany(resturant => resturant.Reviews) .WithRequired(review => review.Resturant); base.OnModelCreating(modelBuilder); } }
and the class definition:
public class Restaurant { //public virtual int ID { get; set; } public virtual int RestaurantId { get; set; } public virtual string Name { get; ...

Go to the complete details ...