Data Driver

Blog archive

Entity Framework Gets Code First (but Not Enum Support!)

No need to wait for that next major .NET Framework upgrade to get Entity Framework improvements, as a stand-alone EF installer is about to be released for the first time.

Entity Framework CTPs have been out for months and have alleviated many user concerns, and Entity Framework 4.1 is due to arrive any week now to address more.

It includes two major components: a DbContext API and Code First capability. The former is basically a simplified and enhanced ObjectContext. Most of the buzz among developers is around the new Code First component.

"Code First alleviates any need for a visual model, you can just create your classes, add any needed configurations to make sure they align with EF rules and go," said EF expert and author Julie Lerman in an interview. "You get the benefits of the ORM [object relational mapping] features offered by EF without the extra layer of having to create your model in a designer and then futz with a code generator to get your classes the way you want them."

Alleviation of the futz factor is a definite plus, indicated Tim Laverty, who as the lead program manager on the Microsoft EF team probably knows as much about Entity Framework as anyone in the world. In an interview, Laverty said Code First "offers a way for 'code-oriented' customers to build EDM [Entity Data Models] models and use EF.  Previously, tooling or a command-line interface was required to create your model unless you were willing to create and edit complex XML files."

Laverty also mentioned that EF 4.1 supplies several conventions, such as database creation, to help developers build apps easier, and also has rich ASP.NET MVC integration.

And developers are likely to be excited about the new DbContext API, too, said Lerman, who wrote a preview of EF 4.1 in MSDN Magazine [full disclosure: my day job is features editor for the mag]. "It's not just that the amount of exposed properties and methods has been reduced," she told this site, "but there are a lot of coding tasks that have been simplified … whereas you have to do a little more juggling with ObjectContext to achieve the same ends."

While many developers lauded the new release when it was announced last week, there's still a big list of improvements they want, such as support for stored procedures, type conversions, enums, bulk updates and more.

"Darn it! No SP support? Cached queries? Very disappointing," said a user named Darius in the comment section of the ADO.NET team blog announcing the "Go-Live Release Candidate." "Guess we'll have to wait a bit longer to use this.  Please just make sure that when you do implement, you do it right. Needs SPs to map to POCO objects or maybe even dynamic objects. Same goes for an ad-hoc SQL query."

Laverty sounded like he's heard about the enum clamor before. "Enum support!" he exclaimed when asked about future improvements (it's actually No. 1 on the uservoice site list, with more than 1,200 requests). "This is our top ask and is in our product plan for vNext," Laverty said. "After that, there's a large backlog: TVF [Table-Valued Function] support, Spatial support, better integration with database projects … better SQL gen, batch CUD [create, update or delete], second-level cache support, sharding support, migrations/database evolution, better [stored procedures] support" and more.

Laverty noted that disassociating EF from the evolution of Visual Studio and .NET Framework releases will help the EF team get improvements out faster--hopefully once per year. "We don't have a locked date for the release after 4.1 but are working on it now," he said.

He said you can let Microsoft know what features you'd like to see in EF in three main ways. "Give us feedback on our uservoice site, our forums, and our blog, please. We actively use each to build and prioritize our product backlog."

What would you like to see done to Entity Framework? Comment here or drop me a note.

Posted by David Ramel on 03/09/2011


comments powered by Disqus

Featured

  • Uno Platform Studio and 'Hot Design' Reach General Availability

    Uno Platform, a .NET-centric open source project for building single-codebase apps across multiple platforms, this week announced v6.0 of its flagship offering, which introduces a zero-install, web-based IDE for rapid cross-platform development, alongside a modernized app architecture that embraces MVU and .NET-style extensions.

  • Mads Kristensen Eyes MCP Server for Visual Studio Copilot

    "What MCP server would be helpful to use with Copilot in Visual Studio? I want to write one."

  • Two Different Takes on Cursor/Copilot Vibe Coding Supremacy

    Cursor and GitHub Copilot go head-to-head in a pair of firsthand reviews. One coder returns to Copilot after it adds support for top LLMs. A coding writer falls for Cursor’s conversational style and beginner-friendly flow.

  • Linear Regression with Two-Way Interactions Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of linear regression with two-way interactions between predictor variables. Compared to standard linear regression, which predicts a single numeric value based only on a linear combination of predictor values, linear regression with interactions can handle more complex data while retaining a high level of model interpretability.

  • Vibe Writing

    Why outline when you can prompt? Vibe writing is the new vibe coding, and yes, it’s exactly what it sounds like.

Subscribe on YouTube

Upcoming Training Events

0 AM
Visual Studio Live! San Diego
September 8-12, 2025
Live! 360 Orlando
November 16-21, 2025
Cloud & Containers Live! Orlando
November 16-21, 2025
Data Platform Live! Orlando
November 16-21, 2025
Visual Studio Live! Orlando
November 16-21, 2025