Use Arrays insted of Lists for better performance
This commit is contained in:
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
public partial class DatabaseService {
|
||||
|
||||
public async Task<List<UserInventory>> GetInventory( Account account, Product product ) {
|
||||
public async Task<UserInventory[]> GetInventory( Account account, Product product ) {
|
||||
List<UserInventory> list = new List<UserInventory>();
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
connection.Open();
|
||||
@@ -40,7 +40,7 @@ namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
async Task UpdateInventory( MySqlConnection connection, AccountInventory item ) {
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Data.Common;
|
||||
namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
public partial class DatabaseService {
|
||||
|
||||
public async Task<List<Receipt>> GetAllReceipts( Account account ) {
|
||||
public async Task<Receipt[]> GetAllReceipts( Account account ) {
|
||||
List<Receipt> receipts = new List<Receipt> ();
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
connection.Open();
|
||||
@@ -43,10 +43,10 @@ namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return receipts;
|
||||
return receipts.ToArray();
|
||||
}
|
||||
|
||||
public async Task<List<( Receipt, Product )>> GetAllReceiptsJoinedToProduct( Account account ) {
|
||||
public async Task<( Receipt, Product )[]> GetAllReceiptsJoinedToProduct( Account account ) {
|
||||
List<( Receipt, Product )> join = new();
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
connection.Open();
|
||||
@@ -100,7 +100,7 @@ namespace MistoxWebsite.Server.Services.DatabaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return join;
|
||||
return join.ToArray();
|
||||
}
|
||||
|
||||
public async Task<Receipt?> GetReceipt( Account account, Product game ) {
|
||||
|
||||
Reference in New Issue
Block a user