Beispiel #1
0
        /**********************************************************************************/
        /// <summary>
        /// Convert crate to DTO
        /// </summary>
        /// <param name="crate"></param>
        /// <returns></returns>
        public CrateDTO ConvertToDto(Crate crate)
        {
            IManifestSerializer serializer = GetSerializer(crate.ManifestType);
            CrateDTO            crateDto   = new CrateDTO
            {
                Id               = crate.Id,
                Label            = crate.Label,
                ManifestId       = crate.ManifestType.Id,
                ManifestType     = crate.ManifestType.Type,
                Availability     = crate.Availability,
                SourceActivityId = crate.SourceActivityId
            };

            if (serializer != null)
            {
                crateDto.Contents = serializer.Serialize(crate.Get <object>());
            }
            else
            {
                crateDto.Contents = crate.GetRaw();
            }

            return(crateDto);
        }
Beispiel #2
0
 public Crate(Crate crate)
     : base(crate.ManifestType, crate.Id, crate.Availability)
 {
     Label        = crate.Label;
     KnownContent = crate.Get <T>();
 }