Some data fixes
This commit is contained in:
parent
c44706124b
commit
43d62557dd
@ -83,6 +83,7 @@ public interface Imm
|
|||||||
public record class Versioned<T> : Imm
|
public record class Versioned<T> : Imm
|
||||||
where T : Versioned<T>
|
where T : Versioned<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
public delegate void ChangeDelegate( T ZZOld, T next );
|
public delegate void ChangeDelegate( T ZZOld, T next );
|
||||||
|
|
||||||
public record class MetaData : Meta
|
public record class MetaData : Meta
|
||||||
@ -94,8 +95,8 @@ public record class Versioned<T> : Imm
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Versioned( )
|
protected Versioned( )
|
||||||
|
: this( new MetaData { Version = 1, Reason = $"Versioned.cons" } )
|
||||||
{
|
{
|
||||||
MetaStorage = new MetaData { Version = 1, Reason = $"Creation" };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Versioned( MetaData meta )
|
internal Versioned( MetaData meta )
|
||||||
|
|||||||
@ -559,15 +559,22 @@ namespace lib
|
|||||||
if( FilterField( filterFields, doImpls, whitelistFields, childFi as MemberInfo, name ) )
|
if( FilterField( filterFields, doImpls, whitelistFields, childFi as MemberInfo, name ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
var useFieldName = true;
|
||||||
|
//Get the value from an attribute named after the field
|
||||||
string attValue = elem.GetAttribute( name );
|
string attValue = elem.GetAttribute( name );
|
||||||
|
|
||||||
|
//Now, if we dont have one, grab one from the property name
|
||||||
if( !string.IsNullOrWhiteSpace( propName ) && string.IsNullOrWhiteSpace( attValue ) )
|
if( !string.IsNullOrWhiteSpace( propName ) && string.IsNullOrWhiteSpace( attValue ) )
|
||||||
|
{
|
||||||
|
useFieldName = false;
|
||||||
attValue = elem.GetAttribute( propName );
|
attValue = elem.GetAttribute( propName );
|
||||||
|
}
|
||||||
|
|
||||||
if( !string.IsNullOrWhiteSpace( attValue ) )
|
if( !string.IsNullOrWhiteSpace( attValue ) )
|
||||||
{
|
{
|
||||||
object existingObj = childFi.GetValue( obj );
|
object existingObj = childFi.GetValue( obj );
|
||||||
|
|
||||||
object childObj = DeserializeConcrete( elem, childFi, attValue, childFi.FieldType );
|
object childObj = DeserializeConcrete( elem, childFi, useFieldName ? name : propName, childFi.FieldType );
|
||||||
|
|
||||||
childFi.SetValue( obj, childObj );
|
childFi.SetValue( obj, childObj );
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user