Fixed wrong typeof

Fixed adding sqlCommapd-part after first object, instead of before
master v1.1
Railz 6 years ago
parent 803b7b7b95
commit 45e7f6b911

@ -51,7 +51,7 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System
public static void ReadDbClassFields<T>(T classObject, ref Dictionary<string, object> dbPrimaryKeys, ref Dictionary<string, object> dbAttributes, ref Dictionary<string, object> dbForeignKeys)
{
Type classType = T.GetType();
Type classType = typeof(T);
// Reset lists (just in case)
dbPrimaryKeys = new Dictionary<string, object> () { };

@ -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);

Loading…
Cancel
Save