コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 static partial void OnEntityCreating(AuthorDto source, ContosoUniversity.DAL.SalesModel.Author target);
コード例 #4
0
 public static AuthorDto ToDto(this ContosoUniversity.DAL.SalesModel.Author source)
 {
     return(source.ToDtoWithRelated(0));
 }
コード例 #5
0
 static partial void OnDtoCreating(ContosoUniversity.DAL.SalesModel.Author source, AuthorDto target);