3 Commits

Author SHA1 Message Date
Railz
0d07d82ff5 Added table-name remover to matching-system of FillObject 2019-07-08 11:41:53 +02:00
Railz
b6bc82a766 Set version to 1.5.12 2019-06-04 22:25:59 +02:00
Railz
3e8427c4c0 Fixed Guid casting to String (dunno?) 2019-06-04 22:25:34 +02:00
2 changed files with 11 additions and 4 deletions

View File

@@ -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();
@@ -57,11 +56,19 @@ 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())
{
object value = data_keySet.Value;
if (baseAttribute.parentField.FieldType == typeof(Guid)) value = new Guid((string)value); // If its a guid, i need to convert
//if (baseAttribute.parentField.FieldType == typeof(Guid)) value = new Guid((string)value); // If its a guid, i need to convert
baseAttribute.parentField.SetValue(classObject, value);
break;

View File

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