zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    OCP-1Z0-053-V12.02-668题
    Oracle DB 监控和优化RMAN
    OCP-1Z0-052-V8.02-123题
    OCP-1Z0-053-V12.02-151题
    OCP-1Z0-053-V12.02-66题
    OCP-1Z0-053-V12.02-163题
    OCP-1Z0-052-V8.02-51题
    OCP-1Z0-052-V8.02-53题
    ostringstream、istringstream、stringstream
    OCP-1Z0-053-V12.02-205题
  • 原文地址:https://www.cnblogs.com/cr-cool/p/12467997.html
Copyright © 2011-2022 走看看