日常生活的交流与学习

首页 新随笔 联系 管理

WebAPI.Jwt.Swagger.Final\Long.EntityFrameworkCore\ApplicationDbContext.cs


using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

namespace Long.EntityFrameworkCore;


public class ApplicationDbContext 
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
    {
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        // 关闭ef core的命令行输出
        optionsBuilder.LogTo(Console.WriteLine,LogLevel.Warning);
    }


    /// <summary>
    /// 模型生成器
    /// </summary>
    /// <param name="modelBuilder"></param>
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
    }
}



posted on 2024-05-10 11:16  lazycookie  阅读(43)  评论(0编辑  收藏  举报