You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, MariaDB, 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.
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.
usingvardb=newBloggingContext();// Inserting data into the databasedb.Add(newBlog{Url="https://blogs.msdn.com/adonet"});db.SaveChanges();// Queryingvarblog=db.Blogs.OrderBy(b =>b.BlogId).First();// Updatingblog.Url="https://devblogs.microsoft.com/dotnet";blog.Posts.Add(newPost{Title="Hello World",Content="I wrote an app using EF Core!"});db.SaveChanges();// Deletingdb.Remove(blog);db.SaveChanges();
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
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.
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 the 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.
usingvarconnection=newSqliteConnection("Data Source=Blogs.db");connection.Open();usingvarcommand=connection.CreateCommand();command.CommandText="SELECT Url FROM Blogs";usingvarreader=command.ExecuteReader();while(reader.Read()){varurl=reader.GetString(0);}
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.