Пример #1
0
        /// <summary>
        /// Invoked when <see cref="ToEntity"/> operation is about to return.
        /// </summary>
        /// <param name="dto"><see cref="SubscriberDto"/> converted from <see cref="Subscriber"/>.</param>
        /// <param name="entity"><see cref="Subscriber"/> converted from <see cref="SubscriberDto"/>.</param>
partial         static void OnEntity(this SubscriberDto dto, Subscriber entity);
Пример #2
0
        /// <summary>
        /// Converts this instance of <see cref="SubscriberDto"/> to an instance of <see cref="Subscriber"/>.
        /// </summary>
        /// <param name="dto"><see cref="SubscriberDto"/> to convert.</param>
        public static Subscriber ToEntity(this SubscriberDto dto)
        {
            if (dto == null) return null;

            var entity = new Subscriber();

            entity.SubscriberId = dto.SubscriberId;
            entity.SubscriberName = dto.SubscriberName;
            entity.Port = dto.Port;
            entity.HostName = dto.HostName;
            entity.Password = dto.Password;

            dto.OnEntity(entity);

            return entity;
        }