小编Inf*_*fii的帖子

使用 Dapper 的内连接获取数据

我正在一个项目上进行数据库操作并开发 WinForms 应用程序 C#,我正在使用 Dapper 从数据库中获取数据,我陷入了需要使用内部联接检索数据的情况。例如。我有两个表 Authors 和 Book 如下:

public class Authors
{
    public int AuthorId { get; set; }
    public string AuthorName { get; set; }
}
public class Book
{
    public int BookId { get; set; }
    public string AuthorId { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }
    public int Price { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

现在在 SQL Server 中,我可以使用以下查询轻松地从中获取数据:

select B.Title,b.Description,b.Price,A.AuthorName from author A inner join …
Run Code Online (Sandbox Code Playgroud)

c# orm dapper micro-orm

4
推荐指数
1
解决办法
5174
查看次数

标签 统计

c# ×1

dapper ×1

micro-orm ×1

orm ×1