From 0d07d82ff52e9f1d5c43e61acc681d507d54e89d Mon Sep 17 00:00:00 2001 From: Railz Date: Mon, 8 Jul 2019 11:41:53 +0200 Subject: [PATCH] Added table-name remover to matching-system of FillObject --- Database-Attribute_System/ClassAction.cs | 11 +++++++++-- .../Database-Attribute_System.csproj | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Database-Attribute_System/ClassAction.cs b/Database-Attribute_System/ClassAction.cs index 353b84a..206c3f0 100644 --- a/Database-Attribute_System/ClassAction.cs +++ b/Database-Attribute_System/ClassAction.cs @@ -43,7 +43,6 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System /// /// Given object (marked with Db-attributes) /// The data - /// This checks if any class-field and data-attribute does not exists in either (Slower) public static void FillObject(T classObject, Dictionary data) { Type classType = classObject.GetType(); @@ -56,7 +55,15 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System { // Interate through class-fields foreach (BaseAttribute baseAttribute in dbObject.baseAttributes) - { + { + // Remove any leading dots and table-specifiers + string dbAttName = data_keySet.Key; + if (dbAttName.Contains(".")) + { + string[] dbAttNameSplit = dbAttName.Split('.'); // Split at the '.' + dbAttName = dbAttNameSplit[dbAttNameSplit.Length - 1]; // Copy the ending text + } + // If its a match, set the value if (baseAttribute._attributeName.ToLower() == data_keySet.Key.ToLower()) { diff --git a/Database-Attribute_System/Database-Attribute_System.csproj b/Database-Attribute_System/Database-Attribute_System.csproj index 4ca33ea..c1086ff 100644 --- a/Database-Attribute_System/Database-Attribute_System.csproj +++ b/Database-Attribute_System/Database-Attribute_System.csproj @@ -4,7 +4,7 @@ netcoreapp2.1 eu.railduction.netcore.dll.Database_Attribute_System false - 1.5.12 + 1.5.13