Exemplo n.º 1
0
        /// <summary>
        /// 取得更新数据的数据库命令
        /// </summary>
        /// <param name="item">实体数据</param>
        /// <returns></returns>
        protected override DapperCommand CreateUpdateCommand(Entity.VersionModule item)
        {
            string sql = $"UPDATE {TableName} SET WHERE VersionId=@VersionId And ModuleId=@ModuleId";

            return(new DapperCommand()
            {
                CommandText = sql,
                Parameters = item
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// 取得插入数据的数据库命令
        /// </summary>
        /// <param name="item">实体数据</param>
        /// <returns></returns>
        protected override DapperCommand CreateInsertCommand(Entity.VersionModule item)
        {
            string sql = $"INSERT INTO {TableName} (VersionId,ModuleId) VALUES (@VersionId,@ModuleId)";

            return(new DapperCommand()
            {
                CommandText = sql,
                Parameters = item
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// 取得删除数据的数据库命令
        /// </summary>
        /// <param name="item">实体实例</param>
        /// <returns></returns>
        protected override DapperCommand CreateDeleteCommand(Entity.VersionModule item)
        {
            string            sql = $"DELETE FROM {TableName} WHERE VersionId=@VersionId And ModuleId=@ModuleId";
            DynamicParameters dynamicParameters = new DynamicParameters();

            dynamicParameters.Add("VersionId", item.VersionId);
            dynamicParameters.Add("ModuleId", item.ModuleId);
            return(new DapperCommand()
            {
                CommandText = sql,
                Parameters = dynamicParameters
            });
        }