public static ContosoUniversity.DAL.SalesModel.Author ToEntity(this AuthorDto source)
        {
            if (source == null)
            {
                return(null);
            }

            var target = new ContosoUniversity.DAL.SalesModel.Author();

            // Properties
            target.Id   = source.Id;
            target.Name = source.Name;

            // User-defined partial method
            OnEntityCreating(source, target);

            return(target);
        }
        public static AuthorDto ToDtoWithRelated(this ContosoUniversity.DAL.SalesModel.Author source, int level)
        {
            if (source == null)
            {
                return(null);
            }

            var target = new AuthorDto();

            // Properties
            target.Id   = source.Id;
            target.Name = source.Name;

            // Navigation Properties
            if (level > 0)
            {
                target.Books = source.Books.ToDtosWithRelated(level - 1);
            }

            // User-defined partial method
            OnDtoCreating(source, target);

            return(target);
        }
 static partial void OnEntityCreating(AuthorDto source, ContosoUniversity.DAL.SalesModel.Author target);
 public static AuthorDto ToDto(this ContosoUniversity.DAL.SalesModel.Author source)
 {
     return(source.ToDtoWithRelated(0));
 }
 static partial void OnDtoCreating(ContosoUniversity.DAL.SalesModel.Author source, AuthorDto target);