Доброе время стуок. Вопрос по поводу класса ContextBuilder и где его можнор найти или его реенкарнации?
Смотрел обзор Ado.Net Entity Framework 4.0 на http://www.techdays.ru/videos/2483.html. Попробовал реализовать на практике подход Code First, но никак не могу найти класс ContextBuilder, код из примера:
Код | var builder = new ContextBuilder<TheMyModelContainer>();
builder.Entity<Country>().Property(e => e.Id) .IsIdentity(); builder.Entity<Country>().Property(e => e.Name) .IsRequired() .HasMaxLength(255);
builder.Entity<Country>() .Relationship<City>(e => e.Cities);
builder.Entity<City>().Property(e => e.Id) .IsIdentity(); builder.Entity<City>().Property(e => e.Name) .IsRequired() .HasMaxLength(255);
using (var context = builder.Create(new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=DD02;Integrated Security=True;MultipleActiveResultSets=True"))
|
Код | public class TheMyModelContainer : ObjectContext { public TheMyModelContainer() : base("name=TheMyModelContainer") { ContextOptions.LazyLoadingEnabled = true; }
public TheMyModelContainer(EntityConnection connection) : base(connection) { ContextOptions.LazyLoadingEnabled = true; }
public ObjectSet<City> Cities { get { return CreateObjectSet<City>(); } }
public ObjectSet<Country> Countries { get { return CreateObjectSet<Country>(); } } }
|
Прочитал что его зарефакторили в ModelBuilder, но такой класс тоже не могу найти ( кто - нибудь может модет подскзать как этот участок кода будет выглядеть в условиях CTP5? |