let today = new Beginning();

Entity Framework Topics about Entity Framework


EF second layer cache to enhance your SQL database performance based on Redis

Entity-Framework Core is a lightweight, extensible, open-source, and cross-platform version of the popular Entity Framework data access technology. It really helps the developer to build applications which access database easily. But in most cases, we may cache some results which do not change frequently, to reduce access to our database. For example, the home page of a blog may not change …

ASP.NET Core C# SQL Server SQL Entity Framework Core Azure Redis Caching

Creating a Model for an existing database in Entity Framework Core

Try to execute the following command under your project folder: $ dotnet ef dbcontext scaffold "Server=....." Microsoft.EntityFrameworkCore.SqlServer -o Models And fill the string Server=..... with your database connection string. Make sure that you can connect to this database successfully. And EF will try to build models from the database. Note: Once you have created the model, you …

C# Entity Framework SQL Server Database Entity Framework Core

Sync data to database with Entity-Framework Core

We already know how to add data to database. That's simple: _dbContext.MyDbSet.Add(myObject); But there may already exists some data in the database. We need to delete the obsolete data, and try to add the missing data. For example, I have some numbers: 1, 1, 2, 2, 3, 3 While in the database there is: 1, 1, 1, 5 To seed the database to the way we expected, we shall delete the first 1 and …

C# Entity Framework Database Data Sync

Tips to get better performance for Entity Framework Core

Only get the data you need And the key reason for your slow query is it outputs too much data. Consider adding: Take(200), Skip() to take only the data you need or the current page requires. Use a pager to generate the report. This might helps a lot. Consider the following code (BAD Example) var myArticles = await _dbContext .Articles .Where(t => t.OwnerId == me.Id) . …

Entity Framework SQL Performance Database

Soft deletion in Entity Framework Core

Soft deletion feature is important in some cases that you need a second step to delete the data in your database. When you first delete it from your C# LinQ query, the data will only be marked as Deleted but not delete in your database. Multi-tenancy is one of the ASP.NET boilerplate's important features. But how can we implement the soft-deletion feature with only pure Entity Framework Core? …

C# Entity Framework SQL Server Soft deletion

Support multi-tenant in pure Entity Framework Core

Multi-tenant requires many features because the data can be separated by different tenants. So when you are accessing the database, you don't need to worry that your operation will affect other tenants. Multi-tenancy is the ASP.NET boilerplate's most important feature and works perfectly with Domain-driven design. But how can we implement the multitenant feature with only pure Entity Framework …

ASP.NET Core C# Entity Framework Multi-tenant

Auto update database for ASP.NET Core with Entity Framework

If your ASP.NET Core project is connecting to your database via entity framework, you can't be unfamiliar with the script: dotnet ef database update. Without executing the script your database is not the latest and this may cause some issues. Traditionally we update the database every time we start our app or publish our app. But we may forget this process and it costs us work. How can we …

ASP.NET Core C# Entity Framework SQL Server

  • 1