使用pomelo和.netcore2.1构建mysql视图

5t7ly7z5  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(310)

显然,在.NETCore2.1中,现在支持视图。我想知道是否有可能用pomelo构建一个视图,如果有,语法是什么?我在视图中尝试了“table”语法,但没有成功:

dotnet ef dbcontext scaffold "Server=myserver.com;Database=myDatabase;User=userame;Password=password;" "Pomelo.EntityFrameworkCore.MySql" -t personsView -o models

它运行,但它只生成dbcontext—它不生成模型。
我使用的是pomelo 2.1.1和visual studio 2017(15.7.5)。我的项目是一个.NETCore2.1WebAPI。在后端,我有MySQLServer5.6.30。

kpbpu008

kpbpu0081#

使用pomelo,可以使用以下命令(在包管理器控制台中)生成模型和上下文类:
scaffold dbcontext[connection\u string]pomelo.entityframeworkcore.mysql-outputdir[output directory]-context[context类名]-f

相关问题