首页 > 解决方案 > 如何在 as.net core EFCore 3 中使用复数 DbSet 属性名称搭建 DbContext?

问题描述

我如何在asp.net core EFCoreDbContext 3 中使用复数DbSet属性名称搭建脚手架?并且如果它们在表名中存在多个大写字母(例如 AutoShipment),它会生成除第一个小写字母之外的所有字母(例如 Autoshipment.cs)

标签: .netentity-frameworkasp.net-coreentity-framework-core

解决方案


救生员,最简单的方法:

在 dbContext 项目中安装这个 NUGET 包: Bricelam.EntityFrameworkCore.Pluralizer ,这是他的源代码: https ://github.com/bricelam/EFCore.Pluralizer

它适用于 .net core 3.1,(对于 .net 5 或更高版本不需要它)


推荐阅读