Using Entity Framework Core with Spanner

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

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.