{{announcement.body}}
{{announcement.title}}

Top Entity Framework Core Tools and Extensions

DZone 's Guide to

Top Entity Framework Core Tools and Extensions

This article discusses the top Entity Framework and Entity Framework Core tools and extensions, like Devart, nHydrate ORM, Entity Framework Plus, and more.

· Web Dev Zone ·
Free Resource

Introduction

Entity Framework is an Object Relational Mapper (ORM) tool from Microsoft that has been an extremely popular ORM tool from the time it was available. It enables developers to create data-centric applications by programming against a conceptual model rather than the relational model thereby solving the impedance mismatch between the way data is represented in the application and how it is actually stored in the database.  

This article discusses the top Entity Framework and Entity Framework Core tools and extensions. The tools and extensions discussed in this article include the following: -

Tools

  • Devart Entity Developer
  • Entity Framework Visual Editor
  • nHydrate ORM for Entity Framework
  • EF Core Power Tools
  • CatFactory


Extensions

  • Microsoft.EntityFrameworkCore.AutoHistory
  • EFCore.BulkExtensions
  • Entity Framework Plus
  • Microsoft.EntityFrameworkCore.UnitOfWork
  • EfCore.InMemoryHelpers
  • EntityFrameworkCore.Cacheable 

Discussion on Entity Framework Tools

This section presents a discussion on the popular Entity Framework Tools.

Devart Entity Developer 

Entity Developer from Devart is a very powerful modeling and code generation tool, an ORM tool to be more precise. Entity developer lets you design your data access layer visually - at the drop of a hat. Since the data access layer generated by Devart contains automated and generated code, chances of error are minimal. 

The official website of Entity Developer states: "Entity Developer can help you design models for various .NET ORMs in one unified interface. You can get support for all ORMs in one tool, or you may purchase a separate edition, working with one of the supported ORMs."

The solution allows using Model-First and Database-First approaches to design the model and generate C# or Visual Basic .NET code. It supports creating all kinds of mapping, such as table splitting, mapping entity to several tables, complex types, inheritance hierarchies, creating entities from SELECT statements and methods from SQL code, etc.

In addition to standalone visual ORM designer and Visual Studio add-in, Entity Developer also provides a console application. It can generate a model from the database, code from the model, create and update the database from model scripts via the command line.

Reference: https://www.devart.com/entitydeveloper/ 

Entity Framework Visual Editor

Entity Framework Visual Editor supports Entity Framework 6 and beyond as well as Entity Framework Core and is available as a Visual Studio 2019 extension. It is available for download from the Visual Studio market place here: https://marketplace.visualstudio.com/items?itemName=michaelsawczyn.EFDesigner

It is a code generator that provides support for inheritance and associations (both unidirectional and bidirectional) and enables simple and fast visual design of persistent classes.

nHydrate ORM for Entity Framework 

nHydrate is a mature, open-source ORM solution for Microsoft's Entity Framework. Note that nHydrate is not a replacement for EF, rather it adds a modeling layer to EF that helps you to visualize and write custom code and extensions seamlessly.

When working on enterprise applications you might need to change or update your underlying database. Although such changes are not done often and are infrequent, you should be able to keep your object model updated so that it is in sync with the objects residing in the database. Feature changes in the application can trigger database changes. 

Here's where nHydrate can help. You can take advantage of nHydrate to model without having to worry about the changes made to the underlying database. When you generate the model from your database using nHydrate, the database change scripts are automatically created and hence the model is in sync with the database.

The latest version of nHydrate ORM Modeler is available for download from the Visual Studio Market Place. Here's the link: https://marketplace.visualstudio.com/items?itemName=nHydrateorg.nHydrateORMModeler

Here’s the Github link: https://github.com/nHydrate/nHydrate

EF Core Power Tools

EF Core Power Tools is a Visual Studio extension that provides useful DbContext features that are added to the VS Solution Explorer context menu. The striking features of EC Core Power Tools include the following: 

  1. Support for reverse engineering of SQL Server, Azure SQL DB, PostgreSQL, MySQL, SQLite, Oracle, and SQL Server Compact databases
  2. Support for migrations tool
  3. Support for model graphing and scripting

 You can download a copy from here: https://marketplace.visualstudio.com/items?itemName=ErikEJ.EFCorePowerTools

CatFactory

CatFactory is a scaffolding engine built in C# and compatible with .NET Core. CatFactory supports Entity Framework Core, Dapper and .NET Core. It can import a database from an existing SQL Server instance and then scaffold a target technology. Here' the Github link: https://github.com/hherzl/CatFactory 

Discussion on Entity Framework Extensions

This section talks about the popular Entity Framework Extensions available. 

Microsoft.EntityFrameworkCore.AutoHistory

This is yet another important plugin for Entity Framework Core. You can take advantage of a plugin for Entity Framework Core named AutoHistory to automatically record data changes history. AutoHistory can record all data change history and then store the changes in a database table named AutoHistories. Note that this feature is disabled by default. 

To enable this feature you should override the OnModelCreating method in your DbContext class and then call the EnableAutoHistory() extension method using the ModelBuilder instance. There's another extension method named EnsureAutoHistory which you should call to ensure automatic history for the particular DbContext.

You can install Microsoft.EntityFrameworkCore.AutoHistory  using the following command at the Package Manager Console: 

PM> Install-Package Microsoft.EntityFrameworkCore.AutoHistory

Here’s the Github link: https://github.com/Arch/AutoHistory

EFCore.BulkExtensions 

When working in data-centric enterprise applications you might often need to perform CRUD operations in bulk. Here's where EFCore.BulkExtensions can help. It is a light-weight extension that can be used for bulk Insert Update Delete and Read (CRUD) operations on SQL Server and SQLite. You can install EFCore.BulkExtensions  using the following command at the Package Manager Console:

PM> Install-Package EFCore.BulkExtensions  

Here's the Github link: https://github.com/borisdj/EFCore.BulkExtensions

Entity Framework Plus

Entity Framework Plus is a free, open-source library that can be used to extend the functionalities of Entity Framework 6 and Entity Framework Core. In other words, it addresses the limitations of Entity Framework and adds a few must-have features to it. You can take advantage of this library to perform several operations such as, filtering, auditing, caching, query future, batch delete, batch update, etc. 

You can download a copy from the official website. Here's the link to the official website: https://entityframework-plus.net/ 

Microsoft.EntityFrameworkCore.UnitOfWork

Microsoft.EntityFrameworkCore.UnitOfWork plugin provides support for repository and unit of work design patterns. It also provides support for multiple databases and distributed transactions. You can install Microsoft.EntityFrameworkCore.UnitOfWork  using the following command at the Package Manager Console:

PM> Install-Package Microsoft.EntityFrameworkCore.UnitOfWork  

Here’s the Github link: https://github.com/Arch/UnitOfWork

EfCore.InMemoryHelpers

The EfCore.InMemoryHelpers plugin provides a wrapper around the Entity Framework Core (EF Core) In-Memory Database Provider. The In-Memory Database Provider is used to work with in-memory databases. Incidentally, the support for in-memory databases was included in SQL Server 2014. 

The striking features of the EfCore.InMemoryHelpers plugin include the following: 

  • Open Source
  • Support for in-memory databases
  • Support for index validation

You can install EfCore.InMemoryHelpers using the following command at the Package Manager Console:

PM> Install-Package EfCore.InMemoryHelpers 

Here's the Github link: https://github.com/FelixBoers/EfCore.InMemoryHelpers

EntityFrameworkCore.Cacheable

Caching is a technology, a strategy to be more precise, that is used to improve the performance of applications by storing the relatively stale data in memory. In doing so, all subsequent requests can retrieve data from the in-memory cache rather than retrieve it from the file system or databases. This improves performance since reading/writing data to/from the memory is much faster than doing the same from the file system or database. 

EntityFrameworkCore.Cacheable is an extension library for Entity Framework. It is a high-performance second-level query cache for Entity Framework and provides support for caching query results of all types. You can install EntityFrameworkCore.Cacheable using the following command at the Package Manager Console:

PM> Install-Package EntityFrameworkCore.Cacheable  

Here's the Github link: https://github.com/SteffenMangold/EntityFrameworkCore.Cacheable

Summary

There are several Entity Framework Tools and Extensions around – you just need to choose the right tools and extensions depending on the requirements of your application. In this article, I’ve presented a discussion on the top tools and extensions in Entity Framework and Entity Framework Core. 

Topics:
.net core, entity framework, entity framework core

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}