Getting Started with EF Core
Install Entity Framework Core
Entity Framework Core is distributed via NuGet. Run the following command in the Package Manager Console in Visual Studio to install the base EF Core 10.0 package:
Install-Package Microsoft.EntityFrameworkCore -Version 10.0
You may also need additional packages depending on your project:
- To enable design-time features such as scaffolding or migrations, install the design package:
Install-Package Microsoft.EntityFrameworkCore.Design -Version 10.0
- To support command-line tools like Scaffold-DbContext, install the tools package:
Install-Package Microsoft.EntityFrameworkCore.Tools -Version 10.0
EF Core 10.0 requires .NET 10. Make sure your project targets .NET 10.
Register the Entity Framework Core Provider
After installing the required NuGet packages, complete the following steps to register the CData EF Core provider in your project:
- Add a reference to System.Data.CData.Connect.dll, located in the lib -> netstandard2.0 subfolder in the installation directory.
- Add a reference to CData.EntityFrameworkCore.Connect.dll:
- This is located in the lib -> net10.0 -> EFCORE100 subfolder.
- Build the project (Build > Build Solution) to complete EF Core registration and ensure all dependencies are linked.
Creating the Data Model
You can create EF Core models using one of two approaches:
- Code-First Approach manually define entity and context classes in code for full control over the model.
- Reverse Engineering (Scaffolding) automatically generate models from your live CData Connect schema using scaffolding tools.