ADO.NET Provider for Redis

Build 24.0.9064

Getting Started with EFCore

Install Entity Framework Core

Install and configure the Entity Framework Core environment. Use the Package Manager Console in Visual Studio to install the appropriate version of EF Core.

EF Core version 6.0 is supported through bundled assemblies.

To download and install EF Core automatically, first run the following command:

Install-Package Microsoft.EntityFrameworkCore -Version 6.0   //Run this command if using EF Core 6.0

Additionally, you'll need to install EF Core's Relational assembly, as shown in the following example::

Install-Package Microsoft.EntityFrameworkCore.Relational -Version 6.0    //Run this command if using EF Core 6.0

If you need access to code pages beyond those bundled with .NET Standard, install the following package:

Install-Package System.Text.Encoding.CodePages

Register the Entity Framework Core Provider

Complete the following steps to register the Entity Framework Core provider:

  1. Add a reference to System.Data.CData.Redis.dll, located in the lib -> netstandard2.0 subfolder in the installation directory.
  2. Add a reference to CData.EntityFrameworkCore.Redis.dll:

    • This is located in the lib -> net6.0 -> EFCORE60 subfolder in the installation directory.

  3. Add the included licensing file (.lic) to your project. You can accomplish this by right-clicking the project in the Solution Explorer, then navigating to Add -> Existing Item -> System.Data.CData.Redis.lic (located in the lib -> netstandard2.0 subfolder in your installation directory). Finally, right-click the licensing file, and set Copy to Output Directory to Copy if newer.
  4. Build the project to complete the setup for using EF Core.

Creating the Data Model

There are two approaches that can be taken in creating the context and entity classes for your application. With the Code-First Approach approach, you can fine-tune your model by writing the classes manually. Alternatively, you can make use of Reverse Engineering (Scaffolding) to generate these classes automatically from your Redis schema.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9064