• ORM框架:Dapper (Demo下载)


       Dapper作为轻量级ORM框架。因其优秀的性能。 整理一下Demo,方便自己和朋友查找

       除了CURD之外, IN查询 联合查询  存储过程  分页查询

       Demo:链接     提取码:vpwf

      数据库:两个表   两个储存过程

    Student表:

     Book表:

     数据库SQL:

    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    SET ANSI_PADDING ON
    GO
    
    CREATE TABLE [dbo].[Book](
        [BID] [int] IDENTITY(1,1) NOT NULL,
        [BookName] [varchar](50) NULL,
        [SID] [int] NULL,
     CONSTRAINT [PK_Book] PRIMARY KEY CLUSTERED 
    (
        [BID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    
    SET ANSI_PADDING OFF
    GO
    
    
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    SET ANSI_PADDING ON
    GO
    
    CREATE TABLE [dbo].[Student](
        [Uid] [int] IDENTITY(1,1) NOT NULL,
        [Name] [varchar](50) NULL,
        [BrithDay] [datetime] NULL,
        [Sex] [int] NULL,
        [Age] [int] NULL,
        [demo] [int] NULL,
     CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED 
    (
        [Uid] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    
    SET ANSI_PADDING OFF
    GO

    存储过程:

    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    -- =============================================
    -- Author:        <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description:    <Description,,>
    -- =============================================
    CREATE PROCEDURE [dbo].[sp_Student]
        @id int
    AS
    BEGIN
        -- SET NOCOUNT ON added to prevent extra result sets from
        -- interfering with SELECT statements.
        SET NOCOUNT ON;
    
        -- Insert statements for procedure here
        SELECT * from Student where  Uid = @id
    END
    
    GO
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    -- =============================================
    -- Author:        <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description:    <Description,,>
    -- =============================================
    CREATE PROCEDURE [dbo].[sp_StudentUpdate]
        @id int,
        @name varchar(50)
    AS
    BEGIN
        -- SET NOCOUNT ON added to prevent extra result sets from
        -- interfering with SELECT statements.
        --SET NOCOUNT ON;
    
        -- Insert statements for procedure here
        update Student set Name=@name where  Uid = @id;select @@ROWCOUNT
    END
    
    GO
  • 相关阅读:
    JavaScript对象与JSON字符串的相互转换
    IE6下javascript:void(0)不可用的解决
    mybatis-spring集成:配置多数据库源中遇到的问题
    网易免费企业邮箱Foxmail设置方法
    ARM Linux 驱动Input子系统之按键驱动测试
    arm Linux 驱动LED子系统 测试
    AM335x内核模块驱动之LED
    ARM开发板搭建NFS网络文件共享方法
    AM335x开发板与PC机虚拟机建立tftp文件传输
    am335xSD卡启动--文件系统制作
  • 原文地址:https://www.cnblogs.com/cr-cool/p/12467997.html
Copyright © 2020-2023  润新知