let today = new Beginning();

SQL Server

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 (DB First)

Install EF first: dotnet tool install --global dotnet-ef 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 …

C# Entity Framework SQL Server Database Entity Framework Core

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

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

Consolidate all Entity-Framework database migrations to one migration

Why do we need to do that? In case you ruined your code or you have too many migrations and caused your editor slow, you may want to reset all migrations. However, deleting all migrations directly in your code will cause database update fail. So I will talk about my solution about how to consolidate all migrations without deleting any data. The following steps only suitable for code-first EF …

ASP.NET Core C# .NET Core Entity Framework SQL Server

How to fix SQL Server database suspect status

In case our SQL Server database can't access, and telling you that it was in suspect status: Common reasons for the state are: The system cannot open the device where the data or log file is located The specified file was not found during the creation or opening of the physical device SQL Server crashes in the middle of the transaction Unable to access data or log files when going online …


  • 1