当前位置:网站首页>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
边栏推荐
- Calculation formula related to tolerance analysis
- How vscode compares the similarities and differences between two files
- 杂文 谈谈古典的《拆掉思维里的墙》
- Variable length parameter__ VA_ ARGS__ Macro definitions for and logging
- Mock test
- PyMySQL
- SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
- [markdown notes]
- 扫码登录的原理你真的了解吗?
- BUG_ me
猜你喜欢
【WPF绑定3】 ListView基础绑定和数据模板绑定
Solution architect's small bag - 5 types of architecture diagrams
Path environment variable
Detailed explanation of Milvus 2.0 quality assurance system
Kunteng full duplex digital wireless transceiver chip kt1605 / kt1606 / kt1607 / kt1608 is suitable for interphone scheme
Feign report 400 processing
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
Zhongang Mining: Fluorite Flotation Process
Shell script -- shell programming specification and variables
批量制造测试数据的思路,附源码
随机推荐
Feign report 400 processing
Generate random numbers with high quality and Gaussian distribution
Use between nodejs modules
Milvus 2.0 質量保障系統詳解
Bytevcharts visual chart library, I have everything you want
Shell脚本——Shell编程规范及变量
Installing labellmg tutorial in Windows
1-2 characteristics of nodejs
Solution architect's small bag - 5 types of architecture diagrams
ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
◰GL-阴影贴图核心步骤
TypeError: set_ figure_ params() got an unexpected keyword argument ‘figsize‘
Promise (I)
自定义my_strcpy与库strcpy【模拟实现字符串相关函数】
An essay on the classical "tear down the wall in thinking"
Bottom processing of stack memory in browser
博士申请 | 厦门大学信息学院郭诗辉老师团队招收全奖博士/博后/实习生
Paging the list collection
Change the password after installing MySQL in Linux
Read a blog, re understand closures and tidy up