Skip to content
/ efcore Public
forked from dotnet/efcore

Microsoft's recommended data access technology for new applications in .NET.

License

Notifications You must be signed in to change notification settings

roji/efcore

This branch is 1 commit ahead of, 5223 commits behind dotnet/efcore:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0974b48 · Mar 1, 2021
Mar 1, 2021
Jan 25, 2021
Dec 7, 2020
Feb 23, 2021
Sep 22, 2020
Mar 1, 2021
Mar 1, 2021
Feb 19, 2021
Aug 23, 2020
Mar 13, 2017
Aug 21, 2019
Dec 19, 2020
Jan 21, 2021
Dec 7, 2020
Sep 23, 2020
Sep 25, 2020
Dec 19, 2020
Dec 22, 2020
Dec 22, 2020
Aug 9, 2019
Dec 22, 2020
Mar 22, 2019
Sep 4, 2020
Feb 22, 2021
Sep 9, 2020
Feb 27, 2019
Mar 11, 2020
Oct 20, 2020
Dec 15, 2020
Jul 6, 2020
Dec 19, 2018
Feb 15, 2021
Jul 23, 2020
Jul 23, 2020
Jul 6, 2020
Mar 18, 2019
Feb 6, 2019
Jul 6, 2020
Mar 18, 2019

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.

Daily builds

We recommend using the daily builds to get the latest code and provide feedback on EF Core. These builds contain latest features and bug fixes; previews and official releases lag significantly behind.

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.

Daily builds

We recommend using the daily builds to get the latest code and provide feedback on Microsoft.Data.Sqlite. These builds contain latest features and bug fixes; previews and official releases lag significantly behind.

Usage

This library implements the common ADO.NET abstractions for connections, commands, data readers, and so on. For more information, see Microsoft.Data.Sqlite on Microsoft Docs.

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

About

Microsoft's recommended data access technology for new applications in .NET.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.2%
  • Other 0.8%