Exemplo n.º 1
0
        public override DeserializationResult Copy()
        {
            var newMapping = new DeserializedFieldEntry[Mapping.Length];

            for (var i = 0; i < Mapping.Length; i++)
            {
                newMapping[i] = Mapping[i].Copy();
            }

            return(IoCManager.Resolve <ISerializationManager>().CreateDataDefinition <T>(newMapping, true));
        }
Exemplo n.º 2
0
        public override DeserializationResult PushInheritanceFrom(DeserializationResult source)
        {
            var dataDef = source.Cast <DeserializedDefinition <T> >();

            if (dataDef.Mapping.Length != Mapping.Length)
            {
                throw new ArgumentException($"Mapping length mismatch in PushInheritanceFrom ({typeof(T)})");
            }

            var newMapping = new DeserializedFieldEntry[Mapping.Length];

            for (var i = 0; i < dataDef.Mapping.Length; i++)
            {
                newMapping[i] = Mapping[i].PushInheritanceFrom(dataDef.Mapping[i]);
            }

            return(IoCManager.Resolve <ISerializationManager>().CreateDataDefinition <T>(newMapping, true));
        }
Exemplo n.º 3
0
        public DeserializedFieldEntry PushInheritanceFrom(DeserializedFieldEntry fieldEntry)
        {
            if (Mapped)
            {
                if (InheritanceBehavior == InheritanceBehavior.Always)
                {
                    if (Result != null)
                    {
                        return(fieldEntry.Result != null
                            ? new DeserializedFieldEntry(Mapped, InheritanceBehavior, Result.PushInheritanceFrom(fieldEntry.Result))
                            : Copy());
                    }
                    else
                    {
                        return(fieldEntry.Copy());
                    }
                }

                return(Copy());
            }

            return(InheritanceBehavior == InheritanceBehavior.Never ? Copy() : fieldEntry.Copy());
        }