C# 使用 dapper 访问 Mysql

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10615998/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 14:31:25  来源:igfitidea点击:

Accessing Mysql using dapper

c#asp.netmysqldapper

提问by Learner

I am new to .NET. I am interested in using the Dapper micro-ORM to access a MySQL backend from an ASP .NET application.

我是 .NET 的新手。我对使用 Dapper micro-ORM 从 ASP .NET 应用程序访问 MySQL 后端感兴趣。

Can this be done? What do I need to know to get started?

这能做到吗?我需要知道什么才能开始?

回答by Alex

Dapperis pretty much DB agnostic and can be used with any backend. All you need to do is providing a valid and open MySQL .NETconnection.

Dapper几乎与数据库无关,可以与任何后端一起使用。您需要做的就是提供有效且开放的MySQL .NET连接。

Quoting the site:

引用网站:

Dapper has no DB specific implementation details, it works across all .net ado providers including sqlite, sqlce, firebird, oracle, MySQL and SQL Server

Dapper 没有特定于 DB 的实现细节,它适用于所有 .net ado 提供程序,包括 sqlite、sqlce、firebird、oracle、MySQL 和 SQL Server

And here's the link to the complete test suite for dapper with a lot of useful examples: https://github.com/StackExchange/Dapper/blob/master/Dapper.Tests.

这是 dapper 完整测试套件的链接,其中包含许多有用的示例:https: //github.com/StackExchange/Dapper/blob/master/Dapper.Tests

There is even a link to some MySQL-specific tests here: https://github.com/StackExchange/Dapper/blob/master/Dapper.Tests/Providers/MySQLTests.cs

这里甚至还有一些特定于 MySQL 的测试的链接:https: //github.com/StackExchange/Dapper/blob/master/Dapper.Tests/Providers/MySQLTests.cs