Added table-name remover to matching-system of FillObject

master v1.5.13
Railz 6 years ago
parent b6bc82a766
commit 0d07d82ff5

@ -43,7 +43,6 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System
/// <typeparam name="T"></typeparam>
/// <param name="classObject">Given object (marked with Db-attributes)</param>
/// <param name="data">The data</param>
/// <param name="runDataLossChecks">This checks if any class-field and data-attribute does not exists in either (Slower)</param>
public static void FillObject<T>(T classObject, Dictionary<string, object> 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())
{

@ -4,7 +4,7 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<RootNamespace>eu.railduction.netcore.dll.Database_Attribute_System</RootNamespace>
<SignAssembly>false</SignAssembly>
<Version>1.5.12</Version>
<Version>1.5.13</Version>
</PropertyGroup>
</Project>

Loading…
Cancel
Save