Beispiel #1
0
        public async virtual Task <ReturnType> SelectByID <ReturnType>(CrudBaseModels.PrimaryKeyID id)
        {
            using IDbConnection dbConnection = new SqlConnection(ConnectionString);

            if (dbConnection.State == ConnectionState.Closed)
            {
                dbConnection.Open();
            }

            DynamicParameters parameter = new DynamicParameters();

            parameter.Add($"@{tableName}ID", id);

            return(await dbConnection.QueryFirstOrDefaultAsync <ReturnType>($"[{schemaName}].APP_SP_SEL_{tableName}_ByID", parameter, commandType : CommandType.StoredProcedure));
        }
Beispiel #2
0
 public async virtual Task <int> Delete(CrudBaseModels.PrimaryKeyID id) => await ExecuteStoredProcedureFirstOrDefaultAsync <int, int>($"[{schemaName}].APP_SP_DEL_{tableName}", id);