当前位置:网站首页>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
边栏推荐
- Copy constructor shallow copy and deep copy
- Error in v-on handler: "typeerror: cannot read property 'resetfields' of undefined"
- Bottom processing of stack memory in browser
- 1-4 configuration executable script of nodejs installation
- TypeError: set_ figure_ params() got an unexpected keyword argument ‘figsize‘
- Do you really understand the principle of code scanning login?
- ByteVCharts可视化图表库,你想要的我都有
- Promise (I)
- Kingdee Cloud Star API calling practice
- 博士申请 | 厦门大学信息学院郭诗辉老师团队招收全奖博士/博后/实习生
猜你喜欢
Grpc gateway based on Ocelot
groutine
Path environment variable
详解牛客----手套
自定义my_strcpy与库strcpy【模拟实现字符串相关函数】
ByteVCharts可视化图表库,你想要的我都有
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
vscode如何比较两个文件的异同
Detailed explanation of Milvus 2.0 quality assurance system
Solution architect's small bag - 5 types of architecture diagrams
随机推荐
Introduction to how to set up LAN
自定义my_strcpy与库strcpy【模拟实现字符串相关函数】
杂文 谈谈古典的《拆掉思维里的墙》
JSON deserialize anonymous array / object
1-1 NodeJS
PHP高效读大文件处理数据
扫码登录的原理你真的了解吗?
Sub database and sub table & shardingsphere
VLAN advanced technology, VLAN aggregation, super VLAN, sub VLAN
Promise (IV)
Variable length parameter__ VA_ ARGS__ Macro definitions for and logging
Rtklib 2.4.3 source code Notes
Do you really understand the principle of code scanning login?
Calculate pie chart percentage
Zhimeng dedecms security setup Guide
◰ GL shadow map core steps
1-3 nodejs installation list configuration and project environment
Promise (II)
Node access to Alipay open platform sandbox to achieve payment function
The new MySQL table has a self increasing ID of 20 bits. The reason is