1、Dapper DAL层方法
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using Model;
namespace DAL
{
public class UserDAL
{
//显示
public List Show()
{
using (SqlConnection conn = new SqlConnection(“Data Source=.;Initial Catalog=Day18-7-6;Integrated Security=True”))
{
return conn.Query(“select * from Yhxx”).ToList();
}
}
//添加
public int Add(YhxxModel s)
{
using (SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=Day18-7-6;Integrated Security=True"))
{
return conn.Execute(string.Format("insert into Yhxx val