src/Azos/Serialization/POD/ReadingStrategy.cs
/// <summary>
/// Constructs object out of CompositeData. This implementation calls ResolveType then tries to invoke attribute constructor first
/// then create instance using default ctor
/// </summary>
Constructs object out of CompositeData. This implementation calls ResolveType then tries to invoke attribute constructor first
then create instance using default ctor
Constructs object out of CompositeData . This implementation calls ResolveType then tries to invoke attribute constructor first then create instance using default ctor
public virtual object ConstructObject(CompositeData data)
        {
            object result = null;
            var clrType =  ResolveType( data.Type );
            var attr = (PortableObjectDocumentDeserializationTransform)clrType
                                                                       .GetCustomAttributes(typeof(PortableObjectDocumentDeserializationTransform), false)
                                                                       .FirstOrDefault();
            if (attr!=null)
                result = attr.ConstructObjectInstance(data);
            if (result==null)
            {
                if (data is CompositeArrayData)
                    result = MakeNewArrayInstance( (CompositeArrayData)data );
                else
                    result = MakeNewObjectInstanceUsingDefaultCtor( clrType );
            }
            if (result!=null)
            {
                List<MethodInfo> methodsOnDeserializing = SerializationUtils.FindSerializationAttributedMethods( result.GetType(), typeof(OnDeserializingAttribute));
                if (methodsOnDeserializing!=null)
                    SerializationUtils.InvokeSerializationAttributedMethods(methodsOnDeserializing, result, data.Document.m_StreamingContext);
            }
            return result;
        }
public virtual object ConstructObject ( CompositeData data ) { object result = null ; var clrType = ResolveType ( data . Type ) ; var attr = ( PortableObjectDocumentDeserializationTransform ) clrType . GetCustomAttributes ( typeof ( PortableObjectDocumentDeserializationTransform ) , false ) . FirstOrDefault ( ) ; if ( attr != null ) result = attr . ConstructObjectInstance ( data ) ; if ( result == null ) { if ( data is CompositeArrayData ) result = MakeNewArrayInstance ( ( CompositeArrayData ) data ) ; else result = MakeNewObjectInstanceUsingDefaultCtor ( clrType ) ; } if ( result != null ) { List < MethodInfo > methodsOnDeserializing = SerializationUtils . FindSerializationAttributedMethods ( result . GetType ( ) , typeof ( OnDeserializingAttribute ) ) ; if ( methodsOnDeserializing != null ) SerializationUtils . InvokeSerializationAttributedMethods ( methodsOnDeserializing , result , data . Document . m_StreamingContext ) ; } return result ; }
Constructs object out of CompositeData.
Constructs object out of CompositeData .
//1 check for attribute --------------- //2 call the dfault .ctor //3 call OnDeserializing
data
CompositeData