Esempio n. 1
0
        public TValue?Convert(ProtoNullable <TChValue> source, TValue?destination, ResolutionContext context)
        {
            if (source == null || !source.HasValue)
            {
                return(null);
            }

            var value = context.Mapper.Map <TValue>(source.Value);

            return(value);
        }
Esempio n. 2
0
        public ProtoNullable <TChValue> Convert(TValue?source, ProtoNullable <TChValue> destination, ResolutionContext context)
        {
            if (!source.HasValue)
            {
                return(new ProtoNullable <TChValue>
                {
                    HasValue = false
                });
            }

            var chValue = context.Mapper.Map <TChValue>(source.Value);

            var dst = new ProtoNullable <TChValue>
            {
                HasValue = source.HasValue,
            };

            if (source.HasValue)
            {
                dst.Value = chValue;
            }
            return(dst);
        }