1 安装FreeSql.generator 工具:
dotnet tool install -g FreeSql.generator
如果报大片红,应该是nuget源找不到,跳到第三步
2 生成实体类
FreeSql.Generator -Razor 1 -NameOptions 1,0,0,0 -NameSpace Zxxxo.Api.Backend -DB "Oracle,user id=xxk;password=Zxxxx21;data source=172.16.xx.xx/orcl;Pooling=true;Max Pool Size=2"
生成成功:
3、配置Nuget源的方法
主要是修改NuGet.Config
Linux上NuGet.Config配置文件位置及修改
vi ~/.nuget/NuGet/NuGet.Config
Windows上NuGet.Config配置文件位置
修改%AppData%\NuGet\NuGet.Config
文件
(window10中%AppData%
是C:\Users\Administrator\AppData\Roaming
)
NuGet.Config文件示例:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<activePackageSource>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</activePackageSource>
</configuration>
例如,想要添加https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
源,则直接向配置文件中packageSources
下添加 <add key="myget" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" protocolVersion="3" />
通过项目根目录中添加nuget.config配置文件自定义源
将nuget.config
配置文件放在项目根目录(一般就是解决方案所在目录),就可以成功添加nuget.config
中自定义的源,例如,
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://nuget.cnblogs.com/v3/index.json" /> </packageSources> </configuration>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?