EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
Перейти к файлу
Shay Rojansky c818a11fca
Rename solution to EFCore.sln (#32344)
2023-11-20 10:30:45 +01:00
.config [release/7.0] Add CodeQL3000 run to efcore-ci-official (#29438) 2022-11-01 19:35:27 -07:00
.github Target .NET 8 2023-07-18 10:22:28 -07:00
benchmark Use OrderedDictionary or Dictionary instead of SortedDictionary in RuntimeModel (#32124) 2023-10-24 16:30:09 -07:00
docs Update DailyBuilds to indicate build to use for EF8 (#32210) 2023-11-02 13:04:34 +00:00
eng Make ModelBuilderTest asserts more robust and extensible (#32221) 2023-11-14 11:44:16 -08:00
logo Add a logo (#32156) 2023-10-26 13:44:35 -07:00
rulesets Add entity splitting support to migration snapshot 2022-06-23 18:06:38 -07:00
src Fix to #29902 - Renaming PeriodStart and PeriodEnd columns of a temporal table causes them to be swapped (#32328) 2023-11-17 14:10:01 -08:00
test Fix to #29902 - Renaming PeriodStart and PeriodEnd columns of a temporal table causes them to be swapped (#32328) 2023-11-17 14:10:01 -08:00
tools Fix for including collection entity which contains JSON 2022-09-08 10:10:24 -07:00
.editorconfig Port simple relationship scenarios from docs samples (#30365) 2023-03-03 10:03:55 +00:00
.gitattributes Update git artifacts 2017-03-13 12:02:22 -07:00
.gitignore Generate type mappings in the compiled model. 2023-08-07 15:37:23 -07:00
Directory.Build.props Add a logo (#32156) 2023-10-26 13:44:35 -07:00
Directory.Build.targets Revert to latest public preview of the .NET SDK (#32203) 2023-11-06 18:38:16 +00:00
EFCore.Cosmos.slnf Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
EFCore.Relational.slnf Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
EFCore.Runtime.slnf Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
EFCore.Sqlite.slnf Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
EFCore.Tools.slnf Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
EFCore.sln Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
EFCore.sln.DotSettings Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
LICENSE.txt Update license to MIT 2021-07-22 20:14:07 -07:00
Microsoft.Data.Sqlite.slnf Rename solution to EFCore.sln (#32344) 2023-11-20 10:30:45 +01:00
NuGet.config Merge branch 'release/8.0' 2023-11-15 09:14:30 +00:00
README.md Add a logo (#32156) 2023-10-26 13:44:35 -07:00
activate.ps1 Add activate scripts 2019-02-27 15:21:05 -08:00
activate.sh Add ability to submit helix job from command line (#20208) 2020-03-11 15:42:48 -07:00
azure-pipelines-richnav.yml Replace explicit richCodeNavigationEnvironment in azure-pipelines-richnav.yml (#32082) 2023-11-06 14:27:02 +00:00
azure-pipelines.yml [internal/release/8.0-rc1] Update dependencies from dnceng/internal/dotnet-runtime 2023-08-18 17:57:43 +00:00
build.cmd Unlink of file '.dotnet/dotnet.exe' failed. Should I try again? (y/n) 2022-02-15 13:36:15 -08:00
build.sh Unlink of file '.dotnet/dotnet.exe' failed. Should I try again? (y/n) 2022-02-15 13:36:15 -08:00
global.json Update global.json 2023-11-14 13:57:00 -08:00
helix.cmd Rename some references (#21757) 2020-07-23 09:59:50 -07:00
helix.sh Rename some references (#21757) 2020-07-23 09:59:50 -07:00
restore.cmd Unlink of file '.dotnet/dotnet.exe' failed. Should I try again? (y/n) 2022-02-15 13:36:15 -08:00
restore.sh Unlink of file '.dotnet/dotnet.exe' failed. Should I try again? (y/n) 2022-02-15 13:36:15 -08:00
startvs.cmd Update solutions to VS 2019 2019-02-05 17:02:19 -08:00
stylecop.json Update license to MIT 2021-07-22 20:14:07 -07:00
test.cmd Unlink of file '.dotnet/dotnet.exe' failed. Should I try again? (y/n) 2022-02-15 13:36:15 -08:00
test.sh Unlink of file '.dotnet/dotnet.exe' failed. Should I try again? (y/n) 2022-02-15 13:36:15 -08:00

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 MIT License.

EF 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.

Basic 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();

Build from source

Most people use EF Core by installing pre-build NuGet packages, as shown above. Alternately, the code can be built and packages can be created directly on your development machine.

Contributing

We welcome community pull requests for bug fixes, enhancements, and documentation. See How to contribute for more information.

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.

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.

Basic 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();

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

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

Build from source

Most people use Microsoft.Data.Sqlite by installing pre-build NuGet packages, as shown above. Alternately, the code can be built and packages can be created directly on your development machine.

Contributing

We welcome community pull requests for bug fixes, enhancements, and documentation. See How to contribute for more information.

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.

See also