In the multiple zoom video, http://www.asp.net/mvc . The model object element was changed to virtual in the middle of the video. He did not give a detailed description of the change. Can someone clarify the need?
public class Restaurant
{
public virtual int ID { get; set; }
public virtual string Name { get; set; }
public virtual Address Address { get; set; }
public virtual ICollection<Review> Reviews { get; set; }
}
By the way, is there IDBContexta repository template in the video? Should the code use a repository template for best practice if not?
public interface IDbContext
{
IQueryable<Restaurant> Restaurants { get; }
IQueryable<Review> Reviews { get; }
int SaveChanges();
T Attach<T>(T entity) where T : class;
T Add<T>(T entity) where T : class;
T Delete<T>(T entity) where T : class;
}
Update: It must be a number of repository templates. Typically, a repository template creates one class for one model object IRepository<T>. This object puts the entire object model into a single interface Restaurants, Reviews. How does this compare to a typical one?