Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddb7f6dc89 | ||
|
|
06aa7969bf |
@@ -57,9 +57,6 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System
|
||||
// Iterate through data
|
||||
foreach (KeyValuePair<string, object> data_keySet in data)
|
||||
{
|
||||
// If the data was set
|
||||
bool dataIsSet = false;
|
||||
|
||||
// Interate through class-fields
|
||||
foreach (KeyValuePair<string, FieldInfo> field_keySet in dbFields)
|
||||
{
|
||||
@@ -67,7 +64,6 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System
|
||||
if (field_keySet.Key.ToLower() == data_keySet.Key.ToLower())
|
||||
{
|
||||
field_keySet.Value.SetValue(classObject, data_keySet.Value);
|
||||
dataIsSet = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -86,11 +82,11 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System
|
||||
/// <param name="classObject">Given object (marked with Db-attributes)</param>
|
||||
/// <param name="queryExecutor">Function to handle query-calls - Has to return Dictionary[attributeName, attributeValue]</param>
|
||||
/// <param name="runDataLossChecks">This checks if any class-field and data-attribute does not exists in either (Slower)</param>
|
||||
public static void ResolveByPrimaryKey<T>(T classObject, Func<string, Dictionary<string, object>> queryExecutor, bool runDataLossChecks = true)
|
||||
public static void ResolveByPrimaryKey<T>(T classObject, Func<string, List<Dictionary<string, object>>> queryExecutor, bool runDataLossChecks = true)
|
||||
{
|
||||
string query = QueryBuilder.SelectByPrimaryKey(classObject);
|
||||
Dictionary<string, object> data = queryExecutor(query);
|
||||
FillObject(classObject, data, runDataLossChecks);
|
||||
List<Dictionary<string, object>> dataSet = queryExecutor(query);
|
||||
FillObject(classObject, dataSet[0], runDataLossChecks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user