From 45e7f6b911c1c7bd3a2abb257adf663cf0042f29 Mon Sep 17 00:00:00 2001 From: Railz Date: Mon, 1 Apr 2019 14:37:51 +0200 Subject: [PATCH] Fixed wrong typeof Fixed adding sqlCommapd-part after first object, instead of before --- Database-Attribute_System/Function.cs | 2 +- Database-Attribute_System/QueryBuilder.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Database-Attribute_System/Function.cs b/Database-Attribute_System/Function.cs index edf87cb..61d6dc1 100644 --- a/Database-Attribute_System/Function.cs +++ b/Database-Attribute_System/Function.cs @@ -51,7 +51,7 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System public static void ReadDbClassFields(T classObject, ref Dictionary dbPrimaryKeys, ref Dictionary dbAttributes, ref Dictionary dbForeignKeys) { - Type classType = T.GetType(); + Type classType = typeof(T); // Reset lists (just in case) dbPrimaryKeys = new Dictionary () { }; diff --git a/Database-Attribute_System/QueryBuilder.cs b/Database-Attribute_System/QueryBuilder.cs index 79af8f9..1000b7d 100644 --- a/Database-Attribute_System/QueryBuilder.cs +++ b/Database-Attribute_System/QueryBuilder.cs @@ -23,7 +23,7 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System // Build where statements with primaryKey/s object[] param = Function.BuildKeyEqualQuery(dbPrimaryKeys, " AND "); // Add SQL-command part - param[0] += $"SELECT * FROM {tableName} WHERE "; + param[0] = $"SELECT * FROM {tableName} WHERE "+ param[0]; // Build and return the query return BuildQuery(param); @@ -52,12 +52,12 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System // Build set-parameters object[] paramSet = Function.BuildKeyEqualQuery(dbAttributes, ", "); // Add SQL-command part - paramSet[0] += $"UPDATE {tableName} SET "; + paramSet[0] = $"UPDATE {tableName} SET "+ paramSet[0]; // Build where-parameters object[] paramWhere = Function.BuildKeyEqualQuery(dbPrimaryKeys, " AND "); // Add SQL-command part - paramWhere[0] += " WHERE "; + paramWhere[0] = " WHERE "+ paramWhere[0]; // Build and return the query return BuildQuery(paramSet, paramWhere); @@ -79,7 +79,7 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System // Build where-parameters object[] paramWhere = Function.BuildKeyEqualQuery(dbPrimaryKeys, " AND "); // Add SQL-command part - paramWhere[0] += $"DELETE FROM {tableName} WHERE "; + paramWhere[0] = $"DELETE FROM {tableName} WHERE "+ paramWhere[0]; // Build and return the query return BuildQuery(paramWhere);