当前位置:网站首页>EF core in ASP Generate core priority database based on net entity model
EF core in ASP Generate core priority database based on net entity model
2022-04-23 17:04:00 【begeneral】
Test environment :
1、vs2019 Community Edition
2、EF CORE 3.1.6
3、ASP.NET CORE 3.1
First we use VS Create a new one ASP.NET CORE Project , And then create a new one .Net Core Class library of . Because in most cases , We all need to put the operation of the database into a class library , Avoid putting all business logic in web In the project . Here's one thing to pay attention to , This class library must be .NET Core Class library of , It can't be .NET Standard Class library of , Otherwise, the following error will be reported :
After the class library is built , Set this class library as the startup project . And then use NuGet Add the following assemblies to the package :
After the assembly is added , Open the package management console , There is a drop-down option for the default item on the top of the console , Set the default project to the current class library . Enter the following command :
Scaffold-DbContext " Your database connection string " Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
If it works , A new one will be added under the root directory of your class library Models Folder , The file under this folder is the entity model of all database tables , Pictured :
版权声明
本文为[begeneral]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554082305.html
边栏推荐
猜你喜欢
PyMySQL
Lock锁
TypeError: set_figure_params() got an unexpected keyword argument ‘figsize‘
【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验
线性代数感悟之2
详解牛客----手套
How vscode compares the similarities and differences between two files
Change the password after installing MySQL in Linux
True math problems in 1959 college entrance examination
线性代数感悟之1
随机推荐
Nodejs installation and environment configuration
Nifi fast installation and file synchronization
Lock lock
Collect blog posts
Go language RPC communication
面试百分百问到的进程,你究竟了解多少
Deeply understand the relevant knowledge of 3D model (modeling, material mapping, UV, normal), and the difference between displacement mapping, bump mapping and normal mapping
PHP efficiently reads large files and processes data
Node access to Alipay open platform sandbox to achieve payment function
织梦DEDECMS安全设置指南
Expression "func" tSource, object "to expression" func "tSource, object" []
El cascade and El select click elsewhere to make the drop-down box disappear
【生活中的逻辑谬误】稻草人谬误和无力反驳不算证明
Shortcut keys (multiline)
1-3 nodejs installation list configuration and project environment
Rtklib 2.4.3 source code Notes
freeCodeCamp----shape_ Calculator exercise
Variable length parameter__ VA_ ARGS__ Macro definitions for and logging
On lambda powertools typescript
MySQL modify master database