Skip to content
EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
C# Other
  1. C# 99.1%
  2. Other 0.9%
Branch: master
Clone or download
ajcvickers Update state manager debug view based on design meeting feedback
Issue #19109

* Moved to StateManager
* Implemented as ToDebugString on InternalEntityEntry
* Used for ToString on InternalEntityEntry
* Also for ToString on external EntityEntry
* Also added DebugView on InternalEntityEntry to access long form for single entry
Latest commit d3214e2 Dec 8, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update CONTRIBUTING.md Nov 25, 2019
benchmark Pin dependencies to 3.1.0 (for now) Dec 3, 2019
docs Move wiki pages to .md in repo Nov 25, 2019
eng Update Version.Details.xml Dec 12, 2019
samples Microsoft.Data.Sqlite: Update encryption sample Oct 18, 2019
src Update state manager debug view based on design meeting feedback Dec 12, 2019
test Updates to simple logging based on design meeting feedback Dec 11, 2019
tools Seal private nested classes to avoid unneeded virtual methods Nov 26, 2019
.editorconfig Just moving some stuff around Nov 2, 2019
.gitattributes Implement SqliteCommand.Prepare. Jul 21, 2017
.gitignore Query: Implement First/Single/Last OrDefault throwing behavior Aug 21, 2019
All.sln Clean Cosmos collections instead of deleting them Sep 26, 2019
All.sln.DotSettings Merge branch 'merge/release/3.1-to-master' of https://github.com/dotn… Nov 2, 2019
Directory.Build.props Pin dependencies to 3.1.0 (for now) Dec 3, 2019
Directory.Build.targets Pin dependencies to 3.1.0 (for now) Dec 3, 2019
EFCore.Cosmos.slnf Tweak solution filter files Aug 9, 2019
EFCore.Relational.slnf Tweak solution filter files Aug 9, 2019
EFCore.Runtime.slnf Remove annotations key when overriden explicitly Aug 29, 2019
EFCore.Sqlite.slnf SQLite SaveChanges: Enable non-rowid store-generated keys Aug 29, 2019
EFCore.Tools.slnf Tweak solution filter files Aug 9, 2019
EFCore.ruleset StyleCop and Jetbrains settings improvements Apr 10, 2019
EFCore.slnf Tweak solution filter files Aug 9, 2019
LICENSE.txt Fix license Mar 22, 2019
Microsoft.Data.Sqlite.slnf Clean up the repo Sep 9, 2019
NuGet.config Update dependencies from https://github.com/dotnet/arcade build 20191… Dec 9, 2019
README.md Move wiki pages to .md in repo Nov 25, 2019
activate.ps1 Add activate scripts Feb 27, 2019
activate.sh Add activate scripts Feb 27, 2019
azure-pipelines.yml Merge branches Nov 25, 2019
build.cmd build.cmd: Avoid confusing the cmd argument parser with too many quotes Sep 16, 2019
build.sh Build using Arcade Dec 19, 2018
global.json Merge pull request #19190 from dotnet-maestro-bot/merge/release/3.1-t… Dec 10, 2019
restore.cmd build.cmd: Avoid confusing the cmd argument parser with too many quotes Sep 16, 2019
restore.sh Make some scripts executable Mar 18, 2019
startvs.cmd Update solutions to VS 2019 Feb 6, 2019
test.cmd build.cmd: Avoid confusing the cmd argument parser with too many quotes Sep 16, 2019
test.sh Make some scripts executable Mar 18, 2019

README.md

Repository

build status test results

This repository is home to the following .NET Foundation projects. These projects are maintained by Microsoft and licensed under the Apache License, Version 2.0.

Entity Framework Core

latest version preview version downloads

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations. EF Core works with SQL Server, Azure SQL Database, SQLite, Azure Cosmos DB, MySQL, PostgreSQL, and other databases through a provider plugin API.

Installation

EF Core is available on NuGet. Install the provider package corresponding to your target database. See the list of providers in the docs for additional databases.

dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
dotnet add package Microsoft.EntityFrameworkCore.Cosmos

Use the --version option to specify a preview version to install.

Use the daily builds to verify bug fixes and provide early feedback.

Usage

The following code demonstrates basic usage of EF Core. For a full tutorial configuring the DbContext, defining the model, and creating the database, see getting started in the docs.

using (var db = new BloggingContext())
{
    // Inserting data into the database
    db.Add(new Blog { Url = "http://blogs.msdn.com/adonet" });
    db.SaveChanges();

    // Querying
    var blog = db.Blogs
        .OrderBy(b => b.BlogId)
        .First();

    // Updating
    blog.Url = "https://devblogs.microsoft.com/dotnet";
    blog.Posts.Add(
        new Post
        {
            Title = "Hello World",
            Content = "I wrote an app using EF Core!"
        });
    db.SaveChanges();

    // Deleting
    db.Remove(blog);
    db.SaveChanges();
}

Microsoft.Data.Sqlite

latest version preview version downloads

Microsoft.Data.Sqlite is a lightweight ADO.NET provider for SQLite. The EF Core provider for SQLite is built on top of this library. However, it can also be used independently or with other data access libraries.

Installation

The latest stable version is available on NuGet.

dotnet add package Microsoft.Data.Sqlite

Use the --version option to specify a preview version to install.

Use the daily builds to verify bug fixes and provide early feedback.

Usage

This library implements the common ADO.NET abstractions for connections, commands, data readers, etc. See the samples directory for additional examples.

using (var connection = new SqliteConnection("Data Source=Blogs.db"))
{
    connection.Open();

    var command = connection.CreateCommand();
    command.CommandText = "SELECT Url FROM Blogs";

    using (var reader = command.ExecuteReader())
    {
        while (reader.Read())
        {
            var url = reader.GetString(0);
        }
    }
}

Getting support

If you have a specific question about using these projects, we encourage you to ask it on Stack Overflow. If you encounter a bug or would like to request a feature, submit an issue. For more details, see getting support.

Contributing

If you're interested in contributing to these projects, see contributing.

See also

You can’t perform that action at this time.