Using Entity Framework Core with Spanner Stay organized with collections Save and categorize content based on your preferences.
TheSpanner Entity Framework Core provider lets youcreate a Spanner database, run queries, and update data through anapplication usingEntity Framework Core. Theprovider is compatible withMicrosoft.EntityFrameworkCore 8.
Set up the Spanner Entity Framework Core provider
To set up the Spanner Entity Framework Core provider in your application, add the followingdependency.
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <OutputType>Exe</OutputType> </PropertyGroup> ... <ItemGroup> <PackageReference Include="Google.Cloud.EntityFrameworkCore.Spanner" Version="3.2.0" /> </ItemGroup> ...</Project>As authentication for the Spanner Entity Framework Core provider, theservice account JSONcredentials file location should be provided in theGOOGLE_APPLICATION_CREDENTIALS environment variable. Otherwise, the providercan also use the default credentials set in the Google Cloud CLIgcloudapplication.
Use the Spanner Entity Framework Core provider
For more information about the available features, limitations of the provider,recommendations on how to use the provider, and for code samples, consultthereference documentation onGitHub.
What's next
- Checkout thecode examples on how to use theSpanner Entity Framework Core provider.
- View the repository for the Spanner Entity Framework Coreprovider onGitHub.
- File aGitHub issue to report a bug or ask aquestion about the Spanner Entity Framework provider.
- Learn more aboutEntity Framework Core.
- Learn more aboutNuGet.
- Learn about authorization and authentication credentials inGetting started with authentication.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.