示例#1
0
        /// <summary>
        /// Invoked when <see cref="ToDTO"/> operation is about to return.
        /// </summary>
        /// <param name="dto"><see cref="ClientDTO"/> converted from <see cref="Client"/>.</param>
partial         static void OnDTO(this Client entity, ClientDTO dto);
示例#2
0
        /// <summary>
        /// Converts this instance of <see cref="Client"/> to an instance of <see cref="ClientDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="Client"/> to convert.</param>
        public static ClientDTO ToDTO(this Client entity)
        {
            if (entity == null) return null;

            var dto = new ClientDTO();

            dto.ClientID = entity.ClientID;
            dto.FirstName = entity.FirstName;
            dto.LastName = entity.LastName;

            entity.OnDTO(dto);

            return dto;
        }