.NET Tips and Tricks

Blog archive

Free Tool: Entity Framework Power Tools

Regardless of what version of Entity Framework (EF) you're using, if you're doing code-first development, you should be looking at Microsoft's Entity Framework Power Tools, even if it is still in beta (Beta 4 appeared in October 2013 and added support for EF 6).

The beauty of code-first development is how easy it is to integrate your own code with the code required by EF. The problem with code-first EF development is the drudgery required to write all the code necessary to model your database. Power Tools goes a long way to eliminating that drudgery by writing the repetitive code for you -- all you have to do is install it through the Tools | Extension Manager menu choice.

To begin using the Power Tools, right-click on your project in Solution Explorer, select Entity Framework | Reverse Engineer Code First and you'll get the standard dialog for connecting to a database. Once you've connected to a database, Power Tools adds to your project the code for a DbContext class, plus the code for an entity class for each table in the database. Once you've generated that code, right-clicking on the file holding the DbContext class gives you access to more Power Tools magic. You should, for instance, be able to generate a read-only version of the database-first visual designer for your model.

I'd be lying if I didn't say that there are reasons that Power Tools is still in beta. Generating an entity class for every table is overkill (for any application I typically only need some of the tables in a database). I wish the Tools would let me use the configuration strings already set up in my project. And I'm not always able to generate the visual designer after generating my DbContext class.

If those “undocumented features” concern you (or you're just uncomfortable with using beta software), there's an alternative: You can use the latest version of EF's visual designer to generate your code.

Posted by Peter Vogel on 03/26/2014


comments powered by Disqus

Featured

  • Full Stack Hands-On Development with .NET

    In the fast-paced realm of modern software development, proficiency across a full stack of technologies is not just beneficial, it's essential. Microsoft has an entire stack of open source development components in its .NET platform (formerly known as .NET Core) that can be used to build an end-to-end set of applications.

  • .NET-Centric Uno Platform Debuts 'Single Project' for 9 Targets

    "We've reduced the complexity of project files and eliminated the need for explicit NuGet package references, separate project libraries, or 'shared' projects."

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

Subscribe on YouTube