【问题标题】:What are the best ways to connect to SQL - Server from Restful API (aspnetcore)从 Restful API (aspnetcore) 连接到 SQL - Server 的最佳方法是什么
【发布时间】:2020-05-03 18:26:50
【问题描述】:

探索一些从 Restful API 连接到用 ASPNETCORE2.2 和 3.x 编写的 SQL Server 的有效方法。我尝试过的实体框架很好,但真的很想了解任何其他连接方式以提高性能。

【问题讨论】:

    标签: asp.net asp.net-core asp.net-web-api


    【解决方案1】:

    Dapper、Dapper contrib 是最新的轻量级和有用的数据层库。您可以从以下链接添加到您的项目中。

    dapper contrib dapper

    【讨论】:

    • 谢谢,直接创建一个没有任何 ORM 的 SQL 连接怎么样。这是个好主意吗。
    • 可能会导致sql注入,也可以通过dapper库直接加载sql执行结果到dto。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-14
    • 2010-09-23
    • 2011-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多