参考 :https://www.jianshu.com/p/c4ca2989d26a
仍有很多其他复杂操作,Dapper真好使
CREATE TABLE [dbo].[Books] (
[BookId] INT NOT NULL,
[Publisher] NVARCHAR (30) NULL,
[Title] NVARCHAR (50) NOT NULL,
CONSTRAINT [PK_Books] PRIMARY KEY CLUSTERED ([BookId] ASC)
);
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
namespace WpfApp16
{
class Book
{
public int BookId{
get; set; }
public string Publisher {
get; set; }
public string Title {
get; set; }
public Book(int id,string pub,string title)
{
this.BookId = id;
this.Publisher = pub;
this.Title = title;
}
public Book()
{
this.BookId = 0;
this.Publisher = "ss";
this.Title = "233";
}
}
class BooksDB
{
private static readonly stri

本文介绍了如何利用Dapper这个轻量级的ORM库,简化C#中的数据库交互,通过实例展示了其在处理复杂操作时的便利性。
最低0.47元/天 解锁文章
1104

被折叠的 条评论
为什么被折叠?



