Hi. The below code doesn't integrate LINQ or EF Core principles, right? How could we make it operate with it?
Code:
```csharp

namespace TravailPratique2_BDD_CSharp
{
 
    public class Row
    {
        public List<string> Fields = new List<string>();

        public Row() { }
        public Row(List<string> fields) { Fields = fields; }
        public Row(params string[] fields)
        {
            foreach (var field in fields)
                Fields.Add(field);
        }
        public override string ToString()
        {
            string str = "";

            for (int i = 0; i < Fields.Count; ++i)
            {
                str += Fields[i] == null ? "NULL" : Fields[i];
                str += i < Fields.Count - 1 ? ", " : "\n";
            }

            return str;
        }

        public void CopyFrom(Row row)
        {
            if (row == null) throw new ArgumentNullException();
            if (Fields.Count != row.Fields.Count) throw new ArgumentException($"Number of fields in source and patch differ! {Fields.Count} != {row.Fields.Count}");

            for (int i = 0; i < Fields.Count; ++i)
                Fields[i] = row.Fields[i];
        }
    }


    public class Table
    {
        public string       Name;
        public List<string> Labels = new List<string>();
        public List<Row>    Rows   = new List<Row>();

        public void AddRow(Row row) { Rows.Add(row); }

        public string ToString(int start, int end) {
            string str = $"{Name} (";
            for (int i = 0; i < Labels.Count; ++i) { 
                str += Labels[i].ToString();
                str += i < Labels.Count - 1 ? ", " : "):\n";
            }

            for (int i = start; i < end; ++i)
                str += Rows[i].ToString(); 

            return str;
        }
        public static List<List<string>> FromSqlQuery(DbContext context, string query)
        {
            if (context == null)                  throw new ArgumentNullException(nameof(context), "DbContext cannot be null.");
            if (string.IsNullOrWhiteSpace(query)) throw new ArgumentException("Query cannot be null or whitespace.", nameof(query));

            var results    = new List<List<string>>();
            var connection = context.Database.GetDbConnection();

            try
            {
                // Open the connection if it's not already open
                if (connection.State != ConnectionState.Open)
                    connection.Open();

                using var command = connection.CreateCommand();
                command.CommandText = query;
                command.CommandType = CommandType.Text;

                using var reader = command.ExecuteReader();

                if (!reader.HasRows) return results;
                int fieldCount = reader.FieldCount;

                while (reader.Read()) {
                    var row = new List<string>();

                    // Iterate through each column in the row
                    for (int i = 0; i < fieldCount; i++) {
                        if (!reader.IsDBNull(i)) {
                            var value = reader.GetValue(i);
                            row.Add(value.ToString());
                        }
                        else row.Add(null);
                    }
                    results.Add(row);
                }
            }

            catch (Exception e) {
                MessageBox.Show($"{e.GetType()}: {e.Message}");
                throw;
            }

            return results;
        }


        public void LoadFromDatabase(AppDbContext appContext) {
            string query = $"SELECT * FROM {Name}";

            List<List<string>> allStrings = FromSqlQuery(appContext, query);

            Console.WriteLine($"Data has {allStrings.Count} entries of {allStrings[0].Count} elements each");       // DEBUG

            foreach (var row in allStrings)
                Rows.Add(new Row(row));
        }

        public Row FindByValue(params string[] fields) {
            if (Rows == null || Rows.Count == 0)      return null;
            if (fields == null || fields.Length == 0) return null;

            Row bestMatch = null;
            int maxMatches = 0;

            foreach (var row in Rows) {
                if (row == null || row.Fields.Count == 0)
                    continue;

                var rowSet         = new HashSet<string>(row.Fields);
                int currentMatches = fields.Count(field => rowSet.Contains(field));

                if (currentMatches > maxMatches) {
                    maxMatches = currentMatches;
                    bestMatch  = row;

                    if (maxMatches == fields.Length)
                        break;
                }
            }

            return bestMatch;
        }


        public List<Row> FindExact(Row compare) {
            List<Row> matches = new List<Row>();

            for (int i = 0; i < Rows.Count; i++) {
                bool mismatch = false;
                for (int j = 0; j < compare.Fields.Count; ++j) {
                    if (Rows[i].Fields[j] != compare.Fields[j])
                        mismatch = true;
                }

                if (!mismatch) matches.Add(Rows[i]);
            }

            return matches;
        }



        public Table(string name, params string[] labels) {
            Name = name;
            foreach (string label in labels)
                Labels.Add(label);
        }
    }

    public class Patch {
        public Table Source;
        public Row   Origin, Target;

        public Patch(Table source, Row origin, Row target) {
            Source = source;
            Origin = origin;
            Target = target;


        }

        public string SqlQuery() {
            string query = $"UPDATE {Source.Name}\n";

            query += "SET ";
            for (int i = 0; i < Source.Labels.Count; ++i) {
                string value = (Target.Fields[i] == null || Target.Fields[i] == "NULL") ? "NULL" : $"'{Target.Fields[i]}'";

                query += $"{Source.Labels[i]} = {value}";
                query += i < Source.Labels.Count - 1 ? ", " : "\n";
            }

            query += "WHERE ";
            for (int i = 0; i < Source.Labels.Count; ++i) {                   
                string value = (Origin.Fields[i] == null || Origin.Fields[i] == "NULL") ? "IS NULL" : $"= '{Origin.Fields[i]}'";

                query += $"{Source.Labels[i]} {value}";
                query += i < Source.Labels.Count - 1 ? " AND " : "\n";
            }

            MessageBox.Show(query);

            return query;
        }

        public void ApplyPatch(AppDbContext appContext) {
            if (!Source.Rows.Contains(Origin)) {
                string e = $"Row {Origin.ToString()} not found in table {Source.Name}";
                MessageBox.Show(e); 
                throw new Exception(e);
            }

            using (var transaction = appContext.Database.BeginTransaction()) {
                try {
                    // Remote changes
                    var affected_rows = appContext.Database.ExecuteSqlRaw(SqlQuery());

                    MessageBox.Show($"Affected {affected_rows} rows");
                    transaction.Commit();


                    // Local changes
                    List<Row> rows = Source.FindExact(Origin);
                    MessageBox.Show($"Found {rows.Count} local affected rows");

                    foreach (Row row in rows)
                        row.CopyFrom(Target);
                }

                catch (Exception e) {
                    transaction.Rollback();
                    MessageBox.Show($"{e.GetType()}: {e.Message}");
                    throw;
                }
            }
        }

        async public void fioerjpeq(AppDbContext appContext) {
            var rs = await appContext.SaveChangesAsync();

            MessageBox.Show(rs.ToString());
        }
    }


    public class Database {

        public List<Table> Tables  = new List<Table>();
        public List<Patch> Patches = new List<Patch>();

        public AppDbContext AppContext;


        public void AddTable(Table table) { Tables.Add(table); }


        public void ApplyPatches() {
            foreach (var patch in Patches)
                patch.ApplyPatch(AppContext);

            Patches.Clear();
        }

        public void LoadFromDB(int start, int end) { }

        public void SendToDB() { }

    }
}
```