csharp的efcore命令

这里记录 csharp 的 efcore 命令.

配置文件 appsettings.json

json

{
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "BloggingDatabase": "Data Source=your_server_ip;Database=your_database_name;User ID=your_username;Min Pool Size=10;Password=your_password;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
  }
}

注入依赖

csharp

services.AddDbContextPool<BloggingContext>(
    options =>{
options.UseSqlServer(Configuration.GetConnectionString("BloggingDatabase")); }
    ,poolSize:64
);