Composing Entity Framework Fluent Configurations

Posted by: K. Scott Allen, on 28 Nov 2011 | View original | Bookmarked: 0 time(s)

The canonical example for fluent configuration with the Entity Framework is to take a few simple entity definitions: public class Product { public int Id { get; set; } public string Name { get; set; } public byte[] Version { get; protected set; } } ... and configure them all inside of the DbContext's OnModelCreating method: protected override void OnModelCreating( DbModelBuilder modelBuilder) { modelBuilder.Entity<Product>().ToTable("products"); // ... more configuration ...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD