Added table-name remover to matching-system of FillObject
This commit is contained in:
parent
b6bc82a766
commit
0d07d82ff5
@ -43,7 +43,6 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System
|
|||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="classObject">Given object (marked with Db-attributes)</param>
|
/// <param name="classObject">Given object (marked with Db-attributes)</param>
|
||||||
/// <param name="data">The data</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)
|
public static void FillObject<T>(T classObject, Dictionary<string, object> data)
|
||||||
{
|
{
|
||||||
Type classType = classObject.GetType();
|
Type classType = classObject.GetType();
|
||||||
@ -56,7 +55,15 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System
|
|||||||
{
|
{
|
||||||
// Interate through class-fields
|
// Interate through class-fields
|
||||||
foreach (BaseAttribute baseAttribute in dbObject.baseAttributes)
|
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 its a match, set the value
|
||||||
if (baseAttribute._attributeName.ToLower() == data_keySet.Key.ToLower())
|
if (baseAttribute._attributeName.ToLower() == data_keySet.Key.ToLower())
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
<RootNamespace>eu.railduction.netcore.dll.Database_Attribute_System</RootNamespace>
|
<RootNamespace>eu.railduction.netcore.dll.Database_Attribute_System</RootNamespace>
|
||||||
<SignAssembly>false</SignAssembly>
|
<SignAssembly>false</SignAssembly>
|
||||||
<Version>1.5.12</Version>
|
<Version>1.5.13</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user